ShortenerServiceProvider::boot()   A
last analyzed

Complexity

Conditions 2
Paths 2

Size

Total Lines 38

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 38
rs 9.312
c 0
b 0
f 0
cc 2
nc 2
nop 0
1
<?php
2
3
namespace danielebuso\shortener;
4
5
use Illuminate\Support\ServiceProvider;
6
7
class ShortenerServiceProvider extends ServiceProvider
8
{
9
    /**
10
     * Bootstrap the application services.
11
     */
12
    public function boot()
13
    {
14
        /*
15
         * Optional methods to load your package assets
16
         */
17
        // $this->loadTranslationsFrom(__DIR__.'/../resources/lang', 'shortener');
18
        // $this->loadViewsFrom(__DIR__.'/../resources/views', 'shortener');
19
        // $this->loadMigrationsFrom(__DIR__.'/../database/migrations');
20
        $this->loadRoutesFrom(__DIR__.'/routes.php');
21
22
        if ($this->app->runningInConsole()) {
23
            $this->publishes([
24
                __DIR__.'/../config/config.php' => config_path('shortener.php'),
25
            ], 'config');
26
27
            $this->publishes([
28
                __DIR__.'/../database/migrations/' => database_path('migrations')
29
            ], 'migrations');
30
31
            // Publishing the views.
32
            /*$this->publishes([
33
                __DIR__.'/../resources/views' => resource_path('views/vendor/laravel-shortener'),
34
            ], 'views');*/
35
36
            // Publishing assets.
37
            /*$this->publishes([
38
                __DIR__.'/../resources/assets' => public_path('vendor/laravel-shortener'),
39
            ], 'assets');*/
40
41
            // Publishing the translation files.
42
            /*$this->publishes([
43
                __DIR__.'/../resources/lang' => resource_path('lang/vendor/laravel-shortener'),
44
            ], 'lang');*/
45
46
            // Registering package commands.
47
            // $this->commands([]);
48
        }
49
    }
50
51
    /**
52
     * Register the application services.
53
     */
54
    public function register()
55
    {
56
        // Automatically apply the package configuration
57
        $this->mergeConfigFrom(__DIR__.'/../config/config.php', 'shortener');
58
59
        // Register the main class to use with the facade
60
        $this->app->singleton('shortener', function () {
61
            return new Shortener;
62
        });
63
    }
64
}
65