/** * Creates a new Reviews model. * If creation is successful, the browser will be redirected to the 'view' page. * @return mixed */ public function actionCreate() { $model = new Reviews(); 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 Reviews model. * If creation is successful, the browser will be redirected to the 'view' page. * @return mixed */ public function actionCreate() { $model = new Reviews(); if ($model->load(Yii::$app->request->post()) && $model->save()) { Yii::$app->session->setFlash('success', 'Спасибо за Ваш отзыв!'); } else { Yii::$app->session->setFlash('danger', 'Не удалось сохранить отзыв. Если ошибка повторится, свяжитесь с нами.'); } return $this->redirect(['index']); }