Completed
Push — master ( 392340...6e5734 )
by Sherif
07:20
created

AclGroupObserver::deleting()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 7
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 7
rs 9.4285
c 0
b 0
f 0
cc 2
eloc 3
nc 2
nop 1
1
<?php namespace App\Modules\V1\Acl\ModelObservers;
2
3
/**
4
 * Handling of model events,
5
 */
6
class AclGroupObserver {
7
8
    public function saving($model)
0 ignored issues
show
Unused Code introduced by
The parameter $model is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
9
    {
10
        //
11
    }
12
13
    public function saved($model)
0 ignored issues
show
Unused Code introduced by
The parameter $model is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
14
    {
15
        //
16
    }
17
18
    public function creating($model)
0 ignored issues
show
Unused Code introduced by
The parameter $model is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
19
    {
20
        //
21
    }
22
23
    public function created($model)
0 ignored issues
show
Unused Code introduced by
The parameter $model is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
24
    {
25
        //
26
    }
27
28
    /**
29
     * Prevent updating of the admin group.
30
     * 
31
     * @param  object $model the model beign updated.
32
     * @return void
33
     */
34
    public function updating($model)
35
    {
36
        if ($model->getOriginal('name') == 'Admin') 
37
        {
38
            \ErrorHandler::noPermissions();
39
        }
40
    }
41
42
    public function updated($model)
0 ignored issues
show
Unused Code introduced by
The parameter $model is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
43
    {
44
        //
45
    }
46
47
    /**
48
     * Prevent deleting the admin group.
49
     * 
50
     * @param  object $model the delted model.
51
     * @return void
52
     */
53
    public function deleting($model)
54
    {
55
        if ($model->getOriginal('name') == 'Admin') 
56
        {
57
            \ErrorHandler::noPermissions();
58
        }
59
    }
60
61
    public function deleted($model)
0 ignored issues
show
Unused Code introduced by
The parameter $model is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
62
    {
63
        //
64
    }
65
66
    public function restoring($model)
0 ignored issues
show
Unused Code introduced by
The parameter $model is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
67
    {
68
        //
69
    }
70
71
    public function restored($model)
0 ignored issues
show
Unused Code introduced by
The parameter $model is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
72
    {
73
        //
74
    }
75
}