public function actionSubscribe() { $model = new Subscribe(); if (Yii::$app->request->isAjax && $model->load(Yii::$app->request->post())) { Yii::$app->response->format = Response::FORMAT_JSON; return ActiveForm::validate($model); } }
public function run() { $model = new Subscribe(); if ($model->load(\Yii::$app->request->post()) && $model->save()) { \Yii::$app->session->setFlash('message', 'Success subscribe'); \Yii::$app->controller->redirect("/"); } return $this->render("subscribe", ['model' => $model]); }
public function run() { $model = new Subscribe(); if ($model->load(Yii::$app->request->post()) && $model->save()) { Yii::$app->session->setFlash('success', 'Success subscribe'); Yii::$app->controller->redirect('/'); } return $this->render('subscribe', ['model' => $model]); }