예제 #1
0
 /**
  * Creates a new SubscribersRecord model.
  * If creation is successful, the browser will be redirected to the 'view' page.
  * @return mixed
  */
 public function actionCreate()
 {
     $model = new SubscribersRecord();
     if ($model->load(Yii::$app->request->post()) && $model->save()) {
         return $this->redirect(['view', 'id' => $model->id]);
     } else {
         return $this->render('create', ['model' => $model]);
     }
 }
예제 #2
0
 public function actionSubscribe()
 {
     $app = \Yii::$app;
     $model = new SubscribersRecord();
     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->save()) {
         \Yii::$app->session->setFlash('subscribeFormSubmitted');
         return $this->redirect(Url::previous());
     }
 }
예제 #3
0
 public function actionSubscribe()
 {
     $app = \Yii::$app;
     $model = new SubscribersRecord();
     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->save()) {
         \Yii::$app->session->setFlash('success', Language::t('flash', 'Вы успешно подписанны на обновления.'));
         return $this->redirect(Url::previous());
     }
 }