1 | <?php |
||
10 | class RoleController extends ResourceController |
||
11 | { |
||
12 | protected array $indexWidgets = [ |
||
|
|||
13 | '\Microboard\Widgets\PopularRole' => [ |
||
14 | 'size' => 'col-md-4' |
||
15 | ], |
||
16 | '\Microboard\Widgets\PermissionsCount' => [ |
||
17 | 'size' => 'col-md-4' |
||
18 | ], |
||
19 | '\Microboard\Widgets\DefaultRole' => [ |
||
20 | 'size' => 'col-md-4' |
||
21 | ], |
||
22 | ]; |
||
23 | |||
24 | /** |
||
25 | * Role has been created. |
||
26 | * |
||
27 | * @param StoreFormRequest $request |
||
28 | * @param Role $model |
||
29 | */ |
||
30 | protected function created($request, $model) |
||
31 | { |
||
32 | $model->permissions()->attach($request->get('permissions')); |
||
33 | } |
||
34 | |||
35 | /** |
||
36 | * Role has been updated. |
||
37 | * |
||
38 | * @param UpdateFormRequest $request |
||
39 | * @param Role $model |
||
40 | */ |
||
41 | protected function updated($request, $model) |
||
42 | { |
||
43 | $model->permissions()->sync($request->get('permissions')); |
||
44 | } |
||
45 | |||
46 | /** |
||
47 | * @return string |
||
48 | */ |
||
49 | protected function getModel(): string |
||
50 | { |
||
51 | return Role::class; |
||
52 | } |
||
53 | |||
54 | /** |
||
55 | * @return string |
||
56 | */ |
||
57 | protected function getDatatable(): string |
||
58 | { |
||
59 | return RoleDataTable::class; |
||
60 | } |
||
61 | |||
62 | /** |
||
63 | * @return string |
||
64 | */ |
||
65 | protected function getStoreFormRequest(): string |
||
66 | { |
||
78 |