/** * Creates a new word. * @return mixed */ public function actionCreate() { $model = new Word(); if ($model->load(Yii::$app->request->post()) && $model->save()) { Yii::$app->session->setFlash('success', '英単語の追加が完了いたしました。'); return $this->redirect(['index']); } return $this->render('create', ['model' => $model]); }
/** * Creates a new Word model. * If creation is successful, the browser will be redirected to the 'view' page. * @return mixed */ public function actionCreate() { $projekt = Projekt::find()->all(); $status = Status::find()->all(); $words_group = WordsGroup::find()->all(); $model = new Word(); if ($model->load(Yii::$app->request->post()) && $model->save()) { return $this->redirect(['view', 'id' => $model->id]); } else { return $this->render('create', ['model' => $model, 'projekt' => $projekt, 'status' => $status, 'words_group' => $words_group]); } }