Total Complexity | 7 |
Total Lines | 51 |
Duplicated Lines | 0 % |
Coverage | 100% |
Changes | 0 |
1 | <?php |
||
10 | class IdeHelperServiceProvider extends ServiceProvider implements DeferrableProvider |
||
11 | { |
||
12 | 4 | public function boot(): void |
|
13 | { |
||
14 | 4 | $this->publishConfig(); |
|
15 | } |
||
16 | |||
17 | 4 | public function register(): void |
|
22 | } |
||
23 | |||
24 | 2 | public function provides(): array |
|
25 | { |
||
26 | 2 | return [ |
|
27 | 2 | ModelsCommand::class, |
|
28 | 2 | ]; |
|
29 | } |
||
30 | |||
31 | 4 | protected function registerIdeHelperHook(): void |
|
32 | { |
||
33 | /** @var \Illuminate\Contracts\Config\Repository $config */ |
||
34 | 4 | $config = $this->app->get('config'); |
|
35 | |||
36 | 4 | if (!$config->get('eloquent-has-many-deep.ide_helper_enabled')) { |
|
37 | 2 | return; |
|
38 | } |
||
39 | |||
40 | 2 | $config->set( |
|
41 | 2 | 'ide-helper.model_hooks', |
|
42 | 2 | array_merge( |
|
43 | 2 | [DeepRelationsHook::class], |
|
44 | 2 | $config->get('ide-helper.model_hooks', []) |
|
45 | 2 | ) |
|
46 | 2 | ); |
|
47 | } |
||
48 | |||
49 | 4 | protected function publishConfig(): void |
|
54 | } |
||
55 | |||
56 | 4 | protected function registerConfig(): void |
|
61 | 4 | ); |
|
62 | } |
||
64 |