CollectServiceProvider::boot()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 2
nc 1
nop 0
dl 0
loc 4
rs 10
c 0
b 0
f 0
1
<?php
2
3
namespace Vetor\Laravel\Collect\Providers;
4
5
use Illuminate\Support\ServiceProvider;
6
use Vetor\Laravel\Collect\Collection\Models\Collection;
7
use Vetor\Laravel\Collect\Collectable\Services\CollectableService;
8
use Vetor\Contracts\Collect\Collection\Models\Collection as CollectionContract;
9
use Vetor\Contracts\Collect\Collectable\Services\CollectableService as CollectableServiceContract;
10
11
class CollectServiceProvider extends ServiceProvider
12
{
13
    /**
14
     * Bootstrap the application events.
15
     *
16
     * @return void
17
     */
18
    public function boot()
19
    {
20
        $this->registerPublishes();
21
        $this->registerMigrations();
22
    }
23
24
    /**
25
     * Register the service provider.
26
     *
27
     * @return void
28
     */
29
    public function register()
30
    {
31
        $this->registerContracts();
32
    }
33
34
    public function registerContracts()
35
    {
36
        $this->app->bind(CollectionContract::class, Collection::class);
37
        $this->app->bind(CollectableServiceContract::class, CollectableService::class);
38
    }
39
40
    /**
41
     * Setup the resource publishing groups for Love.
42
     *
43
     * @return void
44
     */
45
    protected function registerPublishes()
46
    {
47
        if ($this->app->runningInConsole()) {
48
            $this->publishes([
49
                __DIR__ . '/../../database/migrations' => database_path('migrations'),
50
            ], 'migrations');
51
        }
52
    }
53
54
    /**
55
     * Register the Love migrations.
56
     *
57
     * @return void
58
     */
59
    protected function registerMigrations()
60
    {
61
        $this->loadMigrationsFrom(__DIR__ . '/../../database/migrations');
62
    }
63
}
64