Completed
Push — master ( 8f08c7...7bd638 )
by Mohamed
02:25
created

RoleController   A

Complexity

Total Complexity 6

Size/Duplication

Total Lines 56
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 4

Importance

Changes 0
Metric Value
dl 0
loc 56
rs 10
c 0
b 0
f 0
wmc 6
lcom 0
cbo 4

6 Methods

Rating   Name   Duplication   Size   Complexity  
A created() 0 4 1
A updated() 0 4 1
A getModel() 0 4 1
A getDatatable() 0 4 1
A getStoreFormRequest() 0 4 1
A getUpdateFormRequest() 0 4 1
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
    /**
13
     * Role has been created.
14
     *
15
     * @param StoreFormRequest $request
16
     * @param Role $model
17
     */
18
    protected function created($request, $model)
19
    {
20
        $model->permissions()->attach($request->get('permissions'));
21
    }
22
23
    /**
24
     * Role has been updated.
25
     *
26
     * @param UpdateFormRequest $request
27
     * @param Role $model
28
     */
29
    protected function updated($request, $model)
30
    {
31
        $model->permissions()->sync($request->get('permissions'));
32
    }
33
34
    /**
35
     * @return string
36
     */
37
    protected function getModel(): string
38
    {
39
        return Role::class;
40
    }
41
42
    /**
43
     * @return string
44
     */
45
    protected function getDatatable(): string
46
    {
47
        return RoleDataTable::class;
48
    }
49
50
    /**
51
     * @return string
52
     */
53
    protected function getStoreFormRequest(): string
54
    {
55
        return StoreFormRequest::class;
56
    }
57
58
    /**
59
     * @return string
60
     */
61
    protected function getUpdateFormRequest(): string
62
    {
63
        return UpdateFormRequest::class;
64
    }
65
}
66