LaravelFormPartialsServiceProvider::boot()   A
last analyzed

Complexity

Conditions 2
Paths 2

Size

Total Lines 29
Code Lines 12

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 13
CRAP Score 2

Importance

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