| Conditions | 3 |
| Paths | 3 |
| Total Lines | 21 |
| Code Lines | 10 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 24 | public function settings(): ?string |
||
| 25 | { |
||
| 26 | // initialize model and pass configs |
||
| 27 | $model = new FormSettings($this->getConfigs()); |
||
|
|
|||
| 28 | |||
| 29 | // check if form is submited to save data |
||
| 30 | if ($model->send()) { |
||
| 31 | // is validation passed? |
||
| 32 | if ($model->validate()) { |
||
| 33 | // save properties |
||
| 34 | $this->setConfigs($model->getAllProperties()); |
||
| 35 | App::$Session->getFlashBag()->add('success', __('Settings is successful updated')); |
||
| 36 | $this->response->redirect('feedback/index'); |
||
| 37 | } else { |
||
| 38 | App::$Session->getFlashBag()->add('error', __('Form validation is failed')); |
||
| 39 | } |
||
| 40 | } |
||
| 41 | |||
| 42 | // render view |
||
| 43 | return $this->view->render('feedback/settings', [ |
||
| 44 | 'model' => $model |
||
| 45 | ]); |
||
| 47 | } |