/** * Creates a new Book model. * If creation is successful, the browser will be redirected to the 'index' page. * @return mixed */ public function actionCreate() { $model = new BookForm(); $back_url = Url::toRoute('index'); if ($model->load(Yii::$app->request->post()) && $model->insert()) { return $this->redirect(['index']); } else { return $this->render('create', ['model' => $model, 'authors' => Author::find()->all(), 'back_url' => $back_url]); } }