Conditions | 5 |
Paths | 3 |
Total Lines | 15 |
Code Lines | 10 |
Lines | 0 |
Ratio | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
21 | public function run() |
||
22 | { |
||
23 | $model = new SubscribeForm(); |
||
24 | $msgSuccess = BackendMaintenance::t('app', 'We will inform you when everything is ready!'); |
||
25 | $msgInfo = BackendMaintenance::t('app', 'You have already subscribed to the alert!'); |
||
26 | if (($post = Yii::$app->request->post()) && $model->load($post) && $model->validate()) { |
||
|
|||
27 | /** @var Session $session */ |
||
28 | $session = Yii::$app->session; |
||
29 | if ($model->subscribe()) { |
||
30 | $session->setFlash($model::SUBSCRIBE_SUCCESS, $msgSuccess); |
||
31 | } else { |
||
32 | $session->setFlash($model::SUBSCRIBE_INFO, $msgInfo); |
||
33 | } |
||
34 | } |
||
35 | return $this->controller->redirect(Yii::$app->request->referrer); |
||
36 | } |
||
38 |