Passed
Push — main ( 96c6dd...9909c6 )
by Tan
03:05 queued 17s
created

LikeServiceProvider::boot()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 2
Bugs 0 Features 0
Metric Value
cc 1
eloc 1
c 2
b 0
f 0
nc 1
nop 0
dl 0
loc 3
rs 10
1
<?php
2
3
namespace CSlant\LaravelLike\Providers;
4
5
use Illuminate\Support\ServiceProvider;
6
7
class LikeServiceProvider extends ServiceProvider
8
{
9
    /**
10
     * Bootstrap services.
11
     *
12
     * @return void
13
     */
14
    public function boot(): void
15
    {
16
        $this->registerMigration();
17
        $this->registerAssetsPublishing();
18
    }
19
20
    /**
21
     * Register services.
22
     *
23
     * @return void
24
     */
25
    public function register(): void
26
    {
27
        $this->registerConfigs();
28
    }
29
30
    /**
31
     * Get the services provided by the provider.
32
     *
33
     * @return array<string>|null
34
     */
35
    public function provides(): ?array
36
    {
37
        return ['like'];
38
    }
39
40
    /**
41
     * Register the package's migrations.
42
     *
43
     * @return void
44
     */
45
    public function registerMigration(): void
46
    {
47
        $this->loadMigrationsFrom(__DIR__.'/../../migrations');
48
    }
49
50
    /**
51
     * Register configs.
52
     *
53
     * @return void
54
     */
55
    protected function registerConfigs(): void
56
    {
57
        $configPath = __DIR__.'/../../config/like.php';
58
        $this->mergeConfigFrom($configPath, 'like');
59
    }
60
61
    /**
62
     * Register assets publishing.
63
     *
64
     * @return void
65
     */
66
    public function registerAssetsPublishing(): void
67
    {
68
        $configPath = __DIR__.'/../../config/like.php';
69
        $this->publishes([
70
            $configPath => config_path('like.php'),
71
        ], 'config');
72
73
        $this->publishes([
74
            __DIR__.'/../../migrations' => database_path('migrations'),
75
        ], 'migrations');
76
    }
77
}
78