Completed
Push — master ( 9f9877...f2c61d )
by Freek
06:20
created

ModelStatusServiceProvider   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 26
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 2

Importance

Changes 0
Metric Value
wmc 4
lcom 1
cbo 2
dl 0
loc 26
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A boot() 0 18 3
A register() 0 4 1
1
<?php
2
3
namespace Spatie\ModelStatus;
4
5
use Illuminate\Support\ServiceProvider;
6
7
class ModelStatusServiceProvider extends ServiceProvider
8
{
9
    public function boot()
10
    {
11
        if ($this->app->runningInConsole()) {
12
            $this->loadMigrationsFrom(__DIR__.'/../database/migrations/');
13
        }
14
15
        if (! class_exists('CreateStatusesTable')) {
16
            $timestamp = date('Y_m_d_His', time());
17
18
            $this->publishes([
19
                __DIR__.'/../database/migrations/create_statuses_table.php.stub.stub' => database_path('migrations/'.$timestamp.'create_statuses_table.php'),
20
            ], 'migrations');
21
        }
22
23
        $this->publishes([
24
            __DIR__.'/../config/model-status.php' => config_path('model-status.php'),
25
        ], 'config');
26
    }
27
28
    public function register()
29
    {
30
        $this->mergeConfigFrom(__DIR__.'/../config/model-status.php', 'model-status');
31
    }
32
}
33