Completed
Pull Request — master (#9)
by
unknown
01:30
created

ViewServiceProvider::boot()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 30

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 2
nc 2
nop 0
dl 0
loc 30
rs 9.44
c 0
b 0
f 0
1
<?php
2
3
namespace Microboard\Providers;
4
5
use Collective\Html\FormBuilder;
6
use Illuminate\Support\ServiceProvider;
7
8
class ViewServiceProvider extends ServiceProvider
9
{
10
    /**
11
     * Bootstrap any application services.
12
     *
13
     * @return void
14
     */
15
    public function boot()
16
    {
17
        $this->loadTranslationsFrom(__DIR__ . '/../../resources/lang', 'microboard');
18
        $this->loadViewsFrom(__DIR__ . '/../../resources/views', 'microboard');
19
20
        if ($this->app->runningInConsole()) {
21
            $this->publishes([
22
                __DIR__ . '/../../resources/views/index.blade.php' =>
23
                    resource_path('views/vendor/microboard/index.blade.php'),
24
                __DIR__ . '/../../resources/views/layouts/partials/navbar-links.blade.php' =>
25
                    resource_path('views/vendor/microboard/layouts/partials/navbar-links.blade.php'),
26
                __DIR__ . '/../../resources/views/layouts/partials/notifications.blade.php' =>
27
                    resource_path('views/vendor/microboard/layouts/partials/notifications.blade.php'),
28
                __DIR__ . '/../../resources/views/layouts/partials/logo.blade.php' =>
29
                    resource_path('views/vendor/microboard/layouts/partials/logo.blade.php'),
30
                __DIR__ . '/../../resources/views/layouts/partials/user.blade.php' =>
31
                    resource_path('views/vendor/microboard/layouts/partials/user.blade.php'),
32
            ], 'views');
33
34
            $this->publishes([
35
                __DIR__ . '/../../public' => public_path('vendor/microboard'),
36
            ], 'assets');
37
38
            /*$this->publishes([
39
                __DIR__.'/../resources/lang' => resource_path('lang/vendor/microboard'),
40
            ], 'lang');*/
41
        }
42
43
        $this->registerFormComponents();
44
    }
45
46
    public function registerFormComponents()
47
    {
48
        FormBuilder::component(
49
            'argonInput',
50
            'microboard::input',
51
            ['name', 'type', 'value', 'attributes']
52
        );
53
54
        FormBuilder::component(
55
            'argonTextarea',
56
            'microboard::textarea',
57
            ['name', 'value', 'attributes']
58
        );
59
60
        FormBuilder::component(
61
            'argonSelect',
62
            'microboard::select',
63
            ['name', 'list', 'value', 'attributes']
64
        );
65
66
        FormBuilder::component(
67
            'argonCheckbox',
68
            'microboard::checkbox',
69
            ['name', 'value', 'checked', 'attributes']
70
        );
71
72
        FormBuilder::component(
73
            'argonToggle',
74
            'microboard::toggle',
75
            ['name', 'value', 'checked', 'attributes']
76
        );
77
78
        FormBuilder::component(
79
            'avatar',
80
            'microboard::avatar',
81
            ['value', 'attributes']
82
        );
83
84
        FormBuilder::component(
85
            'files',
86
            'microboard::files',
87
            ['value', 'attributes']
88
        );
89
90
        FormBuilder::component(
91
            'trix',
92
            'microboard::trix',
93
            ['name', 'value', 'attributes']
94
        );
95
    }
96
}
97