LaravelJumbotronImagesServiceProvider   A
last analyzed

Complexity

Total Complexity 5

Size/Duplication

Total Lines 68
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 3
Bugs 0 Features 1
Metric Value
eloc 30
c 3
b 0
f 1
dl 0
loc 68
ccs 31
cts 31
cp 1
rs 10
wmc 5

2 Methods

Rating   Name   Duplication   Size   Complexity  
A boot() 0 41 4
A register() 0 8 1
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 20
    public function boot()
16
    {
17
        /*
18
         * Optional methods to load your package assets
19
         */
20
        // $this->loadTranslationsFrom(__DIR__.'/../resources/lang', 'laravel-jumbotron-images');
21 20
        $this->loadViewsFrom(__DIR__.'/../resources/views', 'laravel-jumbotron-images');
22 20
        $this->loadRoutesFrom(__DIR__.'/../routes/web.php');
23
24
        // $this->loadMigrationsFrom(__DIR__.'/../database/migrations');
25 20
        if (! class_exists('CreateQuotesTable')) {
26 20
            $this->publishes([
27 20
                __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 20
            ], 'migrations');
29
        }
30 20
        if (! class_exists('CreateQuoteTranslationsTable')) {
31 20
            $this->publishes([
32 20
                __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 20
            ], 'migrations');
34
        }
35
36 20
        if ($this->app->runningInConsole()) {
37 20
            $this->publishes([
38 20
                __DIR__.'/../config/config.php' => config_path('laravel-jumbotron-images.php'),
39 20
            ], 'config');
40
41
            // Publishing the views.
42 20
            $this->publishes([
43 20
                __DIR__.'/../resources/views' => resource_path('views/vendor/laravel-jumbotron-images'),
44 20
            ], 'views');
45
46
            // Publishing assets.
47 20
            $this->publishes([
48 20
                __DIR__.'/../resources/assets/images' => public_path('vendor/laravel-jumbotron-images/assets/images/'),
49 20
            ], 'images');
50 20
            $this->publishes([
51 20
                __DIR__.'/../resources/assets/sass' => resource_path('sass/vendor/laravel-jumbotron-images/'),
52 20
            ], 'sass');
53 20
            $this->publishes([
54 20
                __DIR__.'/../resources/assets/js' => resource_path('js/vendor/laravel-jumbotron-images/'),
55 20
            ], 'js');
56
57
            // Publishing the translation files.
58
            /*$this->publishes([
59
                __DIR__.'/../resources/lang' => resource_path('lang/vendor/laravel-jumbotron-images'),
60
            ], 'lang');*/
61
62
            // Registering package commands.
63
            // $this->commands([]);
64
        }
65 20
    }
66
67
    /**
68
     * Register the application services.
69
     */
70 20
    public function register()
71
    {
72
        // Automatically apply the package configuration
73 20
        $this->mergeConfigFrom(__DIR__.'/../config/config.php', 'laravel-jumbotron-images');
74
75
        // Register the main class to use with the facade
76
        $this->app->singleton('laravel-jumbotron-images', function () {
77 6
            return new LaravelJumbotronImages;
78 20
        });
79 20
    }
80
}
81