Completed
Pull Request — master (#260)
by Colin
06:42
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
/**
8
 * Class ServiceProvider
9
 *
10
 * @package Cviebrock\EloquentSluggable
11
 */
12
class ServiceProvider extends BaseServiceProvider
13
{
14
15
    /**
16
     * Indicates if loading of the provider is deferred.
17
     *
18
     * @var bool
19
     */
20
    protected $defer = false;
21
22
    /**
23
     * Bootstrap the application events.
24
     *
25
     * @return void
26
     */
27
    public function boot()
28
    {
29
        $this->publishes([
30
            __DIR__ . '/../resources/config/sluggable.php' => config_path('sluggable.php'),
31
        ], 'config');
32
    }
33
34
    /**
35
     * Register the service provider.
36
     *
37
     * @return void
38
     */
39
    public function register()
40
    {
41
        $this->mergeConfigFrom(__DIR__ . '/../resources/config/sluggable.php', 'sluggable');
42
43
        $this->app->singleton(SluggableObserver::class, function ($app) {
44
            return new SluggableObserver(new SlugService(), $app['events']);
45
        });
46
    }
47
48
}
49