1 | <?php |
||||||
2 | |||||||
3 | namespace Apps\Controller\Admin\User; |
||||||
4 | |||||||
5 | |||||||
6 | use Apps\Model\Admin\User\FormUserSettings; |
||||||
7 | use Ffcms\Core\App; |
||||||
8 | use Ffcms\Core\Arch\View; |
||||||
9 | use Ffcms\Core\Network\Request; |
||||||
10 | use Ffcms\Core\Network\Response; |
||||||
11 | |||||||
12 | /** |
||||||
13 | * Trait ActionSettings |
||||||
14 | * @package Apps\Controller\Admin\User |
||||||
15 | * @property Request $request |
||||||
16 | * @property Response $response |
||||||
17 | * @property View $view |
||||||
18 | */ |
||||||
19 | trait ActionSettings |
||||||
20 | { |
||||||
21 | /** |
||||||
22 | * User app settings action |
||||||
23 | * @return string|null |
||||||
24 | * @throws \Ffcms\Core\Exception\SyntaxException |
||||||
25 | */ |
||||||
26 | public function settings(): ?string |
||||||
27 | { |
||||||
28 | // load model and pass property's as argument |
||||||
29 | $model = new FormUserSettings($this->getConfigs()); |
||||||
0 ignored issues
–
show
Bug
introduced
by
Loading history...
|
|||||||
30 | |||||||
31 | if ($model->send()) { |
||||||
32 | if ($model->validate()) { |
||||||
33 | $this->setConfigs($model->getAllProperties()); |
||||||
0 ignored issues
–
show
It seems like
setConfigs() must be provided by classes using this trait. How about adding it as abstract method to this trait?
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
Loading history...
|
|||||||
34 | App::$Session->getFlashBag()->add('success', __('Settings is successful updated')); |
||||||
35 | $this->response->redirect('user/index'); |
||||||
36 | } else { |
||||||
37 | App::$Session->getFlashBag()->add('error', __('Form validation is failed')); |
||||||
38 | } |
||||||
39 | } |
||||||
40 | |||||||
41 | // render view |
||||||
42 | return $this->view->render('user/settings', [ |
||||||
43 | 'model' => $model |
||||||
44 | ]); |
||||||
45 | } |
||||||
46 | } |