| Conditions | 3 |
| Paths | 3 |
| Total Lines | 18 |
| Code Lines | 10 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 29 | public function roleUpdate($id = 0): ?string |
||
| 30 | { |
||
| 31 | // find role or create new object |
||
| 32 | $role = Role::findOrNew($id); |
||
| 33 | |||
| 34 | $model = new FormUserGroupUpdate($role); |
||
| 35 | if ($model->send()) { // work with post request |
||
| 36 | if ($model->validate()) { |
||
| 37 | $model->save(); |
||
| 38 | App::$Session->getFlashBag()->add('success', __('Data was successful updated')); |
||
| 39 | } else { |
||
| 40 | App::$Session->getFlashBag()->add('error', __('Form validation is failed')); |
||
| 41 | } |
||
| 42 | } |
||
| 43 | |||
| 44 | // render view |
||
| 45 | return $this->view->render('user/role_update', [ |
||
| 46 | 'model' => $model |
||
| 47 | ]); |
||
| 49 | } |