コード例 #1
0
ファイル: BooksController.php プロジェクト: logs12/books
 /**
  * Creates a new Books model.
  * If creation is successful, the browser will be redirected to the 'view' page.
  * @return mixed
  */
 public function actionCreate()
 {
     $model = new Books();
     if ($model->load(Yii::$app->request->post()) && $model->upload()) {
         //var_dump(Yii::$app->request->post());die();
         if ($model->save()) {
             return $this->redirect(['index']);
         } else {
             return $this->render('create', ['authors' => Authors::find()->all(), 'model' => $model]);
         }
     } else {
         return $this->render('create', ['authors' => Authors::find()->all(), 'model' => $model]);
     }
 }