Total Complexity | 4 |
Total Lines | 42 |
Duplicated Lines | 0 % |
Changes | 3 | ||
Bugs | 0 | Features | 1 |
1 | <?php |
||
12 | class RepositoryServiceProvider extends ServiceProvider |
||
13 | { |
||
14 | /** |
||
15 | * Bootstrap services. |
||
16 | */ |
||
17 | public function boot() |
||
18 | { |
||
19 | if ($this->app->runningInConsole()) { |
||
20 | $this->commands([ |
||
21 | Generator::class, |
||
22 | Remover::class, |
||
23 | ]); |
||
24 | } |
||
25 | |||
26 | // configs |
||
27 | $this->publishes([ |
||
28 | __DIR__.'/config/repository.php' => config_path('repository.php'), |
||
29 | __DIR__.'/lang/repository.php' => lang_path('en/repository.php'), |
||
30 | ], 'repository'); |
||
31 | |||
32 | // if the configuration is not published then use the package one |
||
33 | if (null === $this->app['config']->get('repository')) { |
||
34 | $this->app['config']->set('repository', require __DIR__.'/config/repository.php'); |
||
35 | } |
||
36 | |||
37 | // return either the published config or the package one |
||
38 | $config = $this->app['config']->get('repository'); |
||
39 | |||
40 | // stubs |
||
41 | $this->publishes([ |
||
42 | realpath(__DIR__.'/stubs') => $config['stubs_path'], |
||
43 | ], 'repository-stubs'); |
||
44 | } |
||
45 | |||
46 | /** |
||
47 | * Register services. |
||
48 | */ |
||
49 | public function register() |
||
54 | ); |
||
55 | } |
||
57 |