public function actionCreate() { $model = new Faq(); if ($model->load(Yii::$app->request->post()) && $model->save()) { return $this->redirect(['view', 'id' => $model->id]); } else { return $this->render('create', ['model' => $model]); } }
/** * Creates a new Faq model. * If creation is successful, the browser will be redirected to the 'view' page. * @return mixed */ public function actionCreate() { $model = new Faq(); if ($model->load(Yii::$app->request->post())) { $model->created_by = Yii::$app->user->identity->username; $model->created_date = date('Y-m-d h:m:s'); $model->modified_by = Yii::$app->user->identity->username; $model->modified_date = date('Y-m-d h:m:s'); $model->status = Status::STATUS_ACTIVE; $model->save(); return $this->redirect(['view', 'id' => $model->id]); } else { return $this->render('create', ['model' => $model]); } }