Passed
Push — main ( 3046a8...52f468 )
by Tan
02:24
created

BlogApiServiceProvider::provides()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
eloc 1
dl 0
loc 3
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 0
1
<?php
2
3
namespace CSlant\Blog\Api\Providers;
4
5
use Illuminate\Support\ServiceProvider;
6
7
class BlogApiServiceProvider 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
    }
73
}
74