示例#1
0
 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);
     }
 }
示例#2
0
 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]);
 }
示例#3
0
 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]);
 }