示例#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());
     }
 }
 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());
     }
 }