Total Complexity | 6 |
Total Lines | 67 |
Duplicated Lines | 0 % |
Coverage | 100% |
Changes | 0 |
1 | <?php |
||
8 | trait EloquentHooks |
||
9 | { |
||
10 | /** |
||
11 | * @param mixed ...$model |
||
12 | * |
||
13 | * @return YouShouldHave |
||
14 | */ |
||
15 | 1 | public function whenYouFetch(...$model) |
|
16 | { |
||
17 | 1 | $model = $this->normalizeInput($model); |
|
|
|||
18 | |||
19 | 1 | return $this->authorizeModel('retrieved', $model); |
|
20 | } |
||
21 | |||
22 | /** |
||
23 | * @param mixed ...$model |
||
24 | * |
||
25 | * @return YouShouldHave |
||
26 | */ |
||
27 | 3 | public function whenYouCreate(...$model) |
|
28 | { |
||
29 | 3 | $model = $this->normalizeInput($model); |
|
30 | |||
31 | 3 | return $this->authorizeModel('creating', $model); |
|
32 | } |
||
33 | |||
34 | /** |
||
35 | * @param mixed ...$model |
||
36 | * |
||
37 | * @return YouShouldHave |
||
38 | */ |
||
39 | 2 | public function whenYouUpdate(...$model) |
|
40 | { |
||
41 | 2 | $model = $this->normalizeInput($model); |
|
42 | |||
43 | 2 | return $this->authorizeModel('updating', $model); |
|
44 | } |
||
45 | |||
46 | /** |
||
47 | * @param mixed ...$model |
||
48 | * |
||
49 | * @return YouShouldHave |
||
50 | */ |
||
51 | 3 | public function whenYouSave(...$model) |
|
56 | } |
||
57 | |||
58 | /** |
||
59 | * @param mixed ...$model |
||
60 | * |
||
61 | * @return YouShouldHave |
||
62 | */ |
||
63 | 2 | public function whenYouDelete(...$model) |
|
64 | { |
||
65 | 2 | $model = $this->normalizeInput($model); |
|
66 | |||
67 | 2 | return $this->authorizeModel('deleting', $model); |
|
68 | } |
||
69 | |||
70 | 9 | private function authorizeModel($event, $modelClass) |
|
75 | } |
||
76 | } |
||
77 |