Total Complexity | 5 |
Total Lines | 46 |
Duplicated Lines | 0 % |
Coverage | 100% |
Changes | 1 | ||
Bugs | 0 | Features | 1 |
1 | <?php |
||
9 | trait CanBootRecordsTrait |
||
10 | { |
||
11 | protected $booted = false; |
||
12 | |||
13 | 31 | public function bootIfNotBooted() |
|
14 | { |
||
15 | 31 | if ($this->booted !== false) { |
|
16 | 1 | return; |
|
17 | } |
||
18 | // $this->fireModelEvent('booting', false); |
||
19 | |||
20 | 31 | $this->booting(); |
|
21 | 31 | $this->boot(); |
|
22 | 31 | $this->booted(); |
|
23 | |||
24 | // $this->fireModelEvent('booted', false); |
||
25 | 31 | $this->booted = true; |
|
26 | 31 | } |
|
27 | |||
28 | /** |
||
29 | * Perform any actions required before the model boots. |
||
30 | * |
||
31 | * @return void |
||
32 | */ |
||
33 | 31 | protected function booting() |
|
34 | { |
||
35 | // |
||
36 | 31 | } |
|
37 | |||
38 | /** |
||
39 | * Bootstrap the model and its traits. |
||
40 | * |
||
41 | * @return void |
||
42 | */ |
||
43 | 31 | protected function boot() |
|
44 | { |
||
45 | 31 | $this->bootTraits(); |
|
|
|||
46 | 31 | } |
|
47 | |||
48 | /** |
||
49 | * Perform any actions required after the model boots. |
||
50 | * |
||
51 | * @return void |
||
52 | */ |
||
53 | 31 | protected function booted() |
|
55 | // |
||
56 | } |
||
57 | } |