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

RoleController::getUpdateFormRequest()   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
    /**
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