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