public function actionFeedback() { $model = new FeedbackForm(); if (\Yii::$app->request->isAjax && $model->load($_POST)) { \Yii::$app->response->format = Response::FORMAT_JSON; return ActiveForm::validate($model); } if ($model->load(\Yii::$app->request->post()) && $model->send()) { \Yii::$app->session->setFlash('contactFormSubmitted'); return $this->redirect(Url::previous()); } return $this->render('feedback', ['model' => $model]); }
public function actionFeedback() { $model = new FeedbackForm(); if (\Yii::$app->request->isAjax && $model->load($_POST)) { \Yii::$app->response->format = Response::FORMAT_JSON; return ActiveForm::validate($model); } if ($model->load(\Yii::$app->request->post()) && $model->send()) { \Yii::$app->session->setFlash('success', Language::t('flash', 'Ваше сообщение успешно отправленно и будет рассмотрено в ближайшее время.')); return $this->redirect(\Yii::$app->request->referrer); } return $this->render('feedback', ['model' => $model]); }