| Total Complexity | 6 |
| Total Lines | 65 |
| Duplicated Lines | 0 % |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 7 | class Blog\ApiServiceProvider extends ServiceProvider |
||
|
|
|||
| 8 | { |
||
| 9 | /** |
||
| 10 | * Bootstrap services. |
||
| 11 | * |
||
| 12 | * @return void |
||
| 13 | */ |
||
| 14 | public function boot(): void |
||
| 15 | { |
||
| 16 | $routePath = __DIR__.'/../../routes/blog-api.php'; |
||
| 17 | if (file_exists($routePath)) { |
||
| 18 | $this->loadRoutesFrom($routePath); |
||
| 19 | } |
||
| 20 | |||
| 21 | $this->loadTranslationsFrom(__DIR__.'/../../lang', 'blog-api'); |
||
| 22 | |||
| 23 | $this->registerCommands(); |
||
| 24 | |||
| 25 | $this->registerAssetPublishing(); |
||
| 26 | } |
||
| 27 | |||
| 28 | /** |
||
| 29 | * Register services. |
||
| 30 | * |
||
| 31 | * @return void |
||
| 32 | */ |
||
| 33 | public function register(): void |
||
| 34 | { |
||
| 35 | $configPath = __DIR__.'/../../config/blog-api.php'; |
||
| 36 | $this->mergeConfigFrom($configPath, 'blog-api'); |
||
| 37 | } |
||
| 38 | |||
| 39 | /** |
||
| 40 | * Get the services provided by the provider. |
||
| 41 | * |
||
| 42 | * @return array<string>|null |
||
| 43 | */ |
||
| 44 | public function provides(): ?array |
||
| 45 | { |
||
| 46 | return ['blog-api']; |
||
| 47 | } |
||
| 48 | |||
| 49 | /** |
||
| 50 | * @return void |
||
| 51 | */ |
||
| 52 | protected function registerCommands(): void |
||
| 53 | { |
||
| 54 | $this->commands([ |
||
| 55 | // |
||
| 56 | ]); |
||
| 57 | } |
||
| 58 | |||
| 59 | /** |
||
| 60 | * @return void |
||
| 61 | */ |
||
| 62 | protected function registerAssetPublishing(): void |
||
| 63 | { |
||
| 64 | $configPath = __DIR__.'/../../config/blog-api.php'; |
||
| 65 | $this->publishes([ |
||
| 66 | $configPath => config_path('blog-api.php'), |
||
| 67 | ], 'config'); |
||
| 68 | |||
| 69 | $this->publishes([ |
||
| 70 | __DIR__.'/../../lang' => resource_path('lang/packages/blog-api'), |
||
| 71 | ], 'lang'); |
||
| 72 | } |
||
| 74 |