Completed
Push — master ( 721ad0...674c3f )
by Davide
03:58
created

LaravelJumbotronImagesServiceProvider::boot()   A

Complexity

Conditions 4
Paths 8

Size

Total Lines 30
Code Lines 17

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 18
CRAP Score 4

Importance

Changes 0
Metric Value
cc 4
eloc 17
nc 8
nop 0
dl 0
loc 30
ccs 18
cts 18
cp 1
crap 4
rs 9.7
c 0
b 0
f 0
1
<?php
2
3
namespace DavideCasiraghi\LaravelJumbotronImages;
4
5
use Carbon\Carbon;
6
use Illuminate\Support\ServiceProvider;
7
8
//use DavideCasiraghi\LaravelJumbotronImages\Console\ResponsiveQuote;
9
//use DavideCasiraghi\LaravelJumbotronImages\Http\Controllers\ResponsiveQuoteController;
10
class LaravelJumbotronImagesServiceProvider extends ServiceProvider
11
{
12
    /**
13
     * Bootstrap the application services.
14
     */
15 13
    public function boot()
16
    {
17
        /*
18
         * Optional methods to load your package assets
19
         */
20
        // $this->loadTranslationsFrom(__DIR__.'/../resources/lang', 'laravel-jumbotron-images');
21 13
        $this->loadViewsFrom(__DIR__.'/../resources/views', 'laravel-jumbotron-images');
22 13
        $this->loadRoutesFrom(__DIR__.'/../routes/web.php');
23
24
        // $this->loadMigrationsFrom(__DIR__.'/../database/migrations');
25 13
        if (! class_exists('CreateQuotesTable')) {
26 13
            $this->publishes([
27 13
                __DIR__.'/../database/migrations/create_jumbotron_images_table.php.stub' => database_path('migrations/'.Carbon::now()->format('Y_m_d_Hmsu').'_create_jumbotron_images_table.php'),
28 13
            ], 'migrations');
29
        }
30 13
        if (! class_exists('CreateQuoteTranslationsTable')) {
31 13
            $this->publishes([
32 13
                __DIR__.'/../database/migrations/create_jumbotron_image_translations_table.php.stub' => database_path('migrations/'.Carbon::now()->format('Y_m_d_Hmsu').'_create_jumbotron_image_translations_table.php'),
33 13
            ], 'migrations');
34
        }
35
36 13
        if ($this->app->runningInConsole()) {
37 13
            $this->publishes([
38 13
                __DIR__.'/../config/config.php' => config_path('laravel-jumbotron-images.php'),
39 13
            ], 'config');
40
41
            // Publishing the views.
42 13
            $this->publishes([
43 13
                __DIR__.'/../resources/views' => resource_path('views/vendor/laravel-jumbotron-images'),
44 13
            ], 'views');
45
46
            // Publishing assets.
47
            /*$this->publishes([
48
                __DIR__.'/../resources/assets' => public_path('vendor/laravel-jumbotron-images'),
49
            ], 'assets');*/
50
51
            // Publishing the translation files.
52
            /*$this->publishes([
53
                __DIR__.'/../resources/lang' => resource_path('lang/vendor/laravel-jumbotron-images'),
54
            ], 'lang');*/
55
56
            // Registering package commands.
57
            // $this->commands([]);
58
        }
59 13
    }
60
61
    /**
62
     * Register the application services.
63
     */
64 13
    public function register()
65
    {
66
        // Automatically apply the package configuration
67 13
        $this->mergeConfigFrom(__DIR__.'/../config/config.php', 'laravel-jumbotron-images');
68
69
        // Register the main class to use with the facade
70
        $this->app->singleton('laravel-jumbotron-images', function () {
71
            return new LaravelJumbotronImages;
72 13
        });
73 13
    }
74
}
75