| Conditions | 3 |
| Paths | 3 |
| Total Lines | 23 |
| Code Lines | 11 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 47 | public function actionSettings(): ?string |
||
| 48 | { |
||
| 49 | // initialize model and pass configs |
||
| 50 | $model = new FormSettings($this->getConfigs()); |
||
| 51 | |||
| 52 | // check if form is submited to save data |
||
| 53 | if ($model->send()) { |
||
| 54 | // is validation passed? |
||
| 55 | if ($model->validate()) { |
||
| 56 | // save properties |
||
| 57 | $this->setConfigs($model->getAllProperties()); |
||
| 58 | App::$Session->getFlashBag()->add('success', __('Settings is successful updated')); |
||
| 59 | $this->response->redirect('feedback/index'); |
||
| 60 | } else { |
||
| 61 | App::$Session->getFlashBag()->add('error', __('Form validation is failed')); |
||
| 62 | } |
||
| 63 | } |
||
| 64 | |||
| 65 | // render view |
||
| 66 | return $this->view->render('settings', [ |
||
| 67 | 'model' => $model |
||
| 68 | ]); |
||
| 69 | } |
||
| 70 | } |
||
| 71 |