Completed
Push — master ( 60f133...b1ddad )
by Colin
08:08 queued 05:16
created

ServiceProvider::boot()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 6
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 2
Bugs 0 Features 0
Metric Value
c 2
b 0
f 0
dl 0
loc 6
rs 9.4285
cc 1
eloc 4
nc 1
nop 0
1
<?php namespace Cviebrock\EloquentSluggable;
2
3
use Cviebrock\EloquentSluggable\Services\SlugService;
4
use Illuminate\Support\ServiceProvider as BaseServiceProvider;
5
6
/**
7
 * Class ServiceProvider
8
 *
9
 * @package Cviebrock\EloquentSluggable
10
 */
11
class ServiceProvider extends BaseServiceProvider
12
{
13
14
    /**
15
     * Indicates if loading of the provider is deferred.
16
     *
17
     * @var bool
18
     */
19
    protected $defer = false;
20
21
    /**
22
     * Bootstrap the application events.
23
     *
24
     * @return void
25
     */
26
    public function boot()
27
    {
28
        $this->publishes([
29
            __DIR__ . '/../resources/config/sluggable.php' => config_path('sluggable.php'),
30
        ], 'config');
31
    }
32
33
    /**
34
     * Register the service provider.
35
     *
36
     * @return void
37
     */
38
    public function register()
39
    {
40
        $this->mergeConfigFrom(__DIR__ . '/../resources/config/sluggable.php', 'sluggable');
41
42
        $this->app->singleton(SluggableObserver::class, function ($app) {
43
            return new SluggableObserver(new SlugService(), $app['events']);
44
        });
45
    }
46
}
47