/** * Creates a new Question model. * If creation is successful, the browser will be redirected to the 'view' page. * @return mixed */ public function actionCreate() { $model = new Question(); if ($model->load(Yii::$app->request->post()) && $model->save()) { return $this->redirect(['view', 'id' => $model->fr_id]); } else { return $this->render('create', ['model' => $model]); } }
public function actionCreate($id_ank) { $model = new Question(['id_ank' => $id_ank]); if ($model->load(Yii::$app->request->post()) && $model->save()) { Yii::$app->session->addFlash('success', Yii::t('app', "Record was successfully created.")); return $this->redirect(['update', 'id' => $model->id_q]); } else { return $this->render('create', ['model' => $model]); } }
/** * Creates a new Question model. * If creation is successful, the browser will be redirected to the 'view' page. * @return mixed */ public function actionCreate() { if (!\Yii::$app->user->can('7progress')) { return $this->goBack(); // goHome } $model = new Question(); if ($model->load(Yii::$app->request->post())) { $model->user_created = Yii::$app->user->id; $model->created = time(); $model->save(); return $this->redirect(['index']); // return $this->redirect(['view', 'id' => $model->id]); } else { if (Yii::$app->request->isAjax) { return $this->renderAjax('create', ['model' => $model]); } else { return $this->render('create', ['model' => $model, 'upDate' => true]); } } }