Completed
Push — master ( 1680b9...7d3d6e )
by Mohamed
15s queued 11s
created

RoleController::getDatatable()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
nc 1
nop 0
dl 0
loc 4
rs 10
c 0
b 0
f 0
1
<?php
2
3
namespace Microboard\Http\Controllers;
4
5
use Microboard\DataTables\RoleDataTable;
6
use Microboard\Http\Requests\Role\StoreFormRequest;
7
use Microboard\Http\Requests\Role\UpdateFormRequest;
8
use Microboard\Models\Role;
9
10
class RoleController extends ResourceController
11
{
12
    protected array $indexWidgets = [
0 ignored issues
show
Bug introduced by
This code did not parse for me. Apparently, there is an error somewhere around this line:

Syntax error, unexpected T_ARRAY, expecting T_FUNCTION or T_CONST
Loading history...
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
    {
67
        return StoreFormRequest::class;
68
    }
69
70
    /**
71
     * @return string
72
     */
73
    protected function getUpdateFormRequest(): string
74
    {
75
        return UpdateFormRequest::class;
76
    }
77
}
78