BladeFormComponentsServiceProvider::boot()   A
last analyzed

Complexity

Conditions 2
Paths 2

Size

Total Lines 16
Code Lines 8

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
eloc 8
c 0
b 0
f 0
dl 0
loc 16
rs 10
cc 2
nc 2
nop 0
1
<?php
2
3
namespace SoareCostin\BladeFormComponents;
4
5
use Illuminate\Support\Facades\Blade;
6
use Illuminate\Support\ServiceProvider;
7
8
class BladeFormComponentsServiceProvider extends ServiceProvider
9
{
10
    /**
11
     * Bootstrap the application services.
12
     */
13
    public function boot()
14
    {
15
        /*
16
         * Optional methods to load your package assets
17
         */
18
        $this->loadViewsFrom(__DIR__.'/../resources/views', 'blade-form-components');
19
20
        if ($this->app->runningInConsole()) {
21
            $this->publishes([
22
                __DIR__.'/../config/config.php' => config_path('blade-form-components.php'),
23
            ], 'config');
24
        }
25
26
        Blade::directive(
27
            'form',
28
            $this->app->make(CompileFormDirective::class)
29
        );
30
    }
31
32
    /**
33
     * Register the application services.
34
     */
35
    public function register()
36
    {
37
        // Automatically apply the package configuration
38
        $this->mergeConfigFrom(__DIR__.'/../config/config.php', 'blade-form-components');
39
40
        $this->app->singleton(Form::class, function () {
41
            return new Form();
42
        });
43
    }
44
}
45