LaravelDatagridServiceProvider   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 59
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 3

Importance

Changes 0
Metric Value
wmc 3
lcom 1
cbo 3
dl 0
loc 59
c 0
b 0
f 0
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A boot() 0 39 2
A register() 0 10 1
1
<?php
2
3
namespace WdevRs\LaravelDatagrid;
4
5
use Illuminate\Support\ServiceProvider;
6
7
class LaravelDatagridServiceProvider 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', 'laravel-datagrid');
18
         $this->loadViewsFrom(__DIR__.'/../resources/views', 'laravel-datagrid');
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('laravel-datagrid.php'),
25
            ], 'config');
26
27
            // Publishing the views.
28
            $this->publishes([
29
                __DIR__.'/../resources/views' => resource_path('views/vendor/laravel-datagrid'),
30
            ], 'views');
31
32
            // Publishing the js.
33
            $this->publishes([
34
                __DIR__.'/../resources/js' => resource_path('js/vendor/laravel-datagrid'),
35
            ], 'js');
36
37
            // Publishing assets.
38
            /*$this->publishes([
39
                __DIR__.'/../resources/assets' => public_path('vendor/laravel-datagrid'),
40
            ], 'assets');*/
41
42
            // Publishing the translation files.
43
            /*$this->publishes([
44
                __DIR__.'/../resources/lang' => resource_path('lang/vendor/laravel-datagrid'),
45
            ], 'lang');*/
46
47
            // Registering package commands.
48
            // $this->commands([]);
49
        }
50
    }
51
52
    /**
53
     * Register the application services.
54
     */
55
    public function register()
56
    {
57
        // Automatically apply the package configuration
58
        $this->mergeConfigFrom(__DIR__.'/../config/config.php', 'laravel-datagrid');
59
60
        // Register the main class to use with the facade
61
        $this->app->singleton('laravel-datagrid', function () {
62
            return new LaravelDatagrid;
63
        });
64
    }
65
}
66