Completed
Push — master ( 1c25ec...c649d9 )
by Bence
09:35
created

ServiceProvider::provides()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 6

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 6
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 0
1
<?php
2
3
namespace Iben\Statable;
4
5
use Iben\Statable\Services\StateHistoryManager;
6
use Illuminate\Support\ServiceProvider as BaseServiceProvider;
7
8
class ServiceProvider extends BaseServiceProvider
9
{
10
    /**
11
     * Indicates if loading of the provider is deferred.
12
     *
13
     * @var bool
14
     */
15
    protected $defer = false;
16
17
    /**
18
     * Bootstrap the application services.
19
     */
20
    public function boot()
21
    {
22
        if ($this->app->runningInConsole()) {
23
            $this->publishes([
24
                __DIR__.'/../config/state-machine.php' => config_path('state-machine.php'),
25
            ], 'config');
26
        }
27
28
        if (! class_exists('CreateStateHistoryTable')) {
29
            $this->publishes([
30
                __DIR__.'/../database/migrations/create_state_history_table.php.stub' => database_path('migrations/'.date('Y_m_d_His', time()).'_create_state_history_table.php'),
31
            ], 'migrations');
32
        }
33
    }
34
35
    /**
36
     * Register the application services.
37
     */
38
    public function register()
39
    {
40
        $this->app->bind('StateHistoryManager', function () {
41
            return new StateHistoryManager();
42
        });
43
    }
44
}
45