Completed
Push — master ( 7fb3e5...8dd154 )
by Clement
01:28
created

FormBladeComponentsServiceProvider::boot()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 4
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 0
1
<?php
2
3
namespace Mydnic\FormBladeComponents;
4
5
use Illuminate\Support\Facades\Blade;
6
use Illuminate\Support\Facades\Route;
7
use Illuminate\Support\ServiceProvider;
8
9
class FormBladeComponentsServiceProvider extends ServiceProvider
10
{
11
    /**
12
     * Register any package services.
13
     *
14
     * @return void
15
     */
16
    public function register()
17
    {
18
        if ($this->app->runningInConsole()) {
19
            $this->registerPublishing();
20
        }
21
    }
22
    
23
    public function boot()
24
    {
25
        $this->registerBladeComponents();
26
    }
27
28
    private function registerBladeComponents()
29
    {
30
        Blade::component('components.form.input', 'input');
31
        Blade::component('components.form.textarea', 'textarea');
32
        Blade::component('components.form.select', 'select');
33
        Blade::component('components.form.checkbox', 'checkbox');
34
    }
35
36
    public function registerPublishing()
37
    {
38
        $this->publishes([
39
            __DIR__ . '/../resources/views/components' => resource_path('views/components'),
40
        ], 'blade-components');
41
    }
42
}
43