NormalFieldServiceProvider::register()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 2
Code Lines 0

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 0
nc 1
nop 0
dl 0
loc 2
c 1
b 0
f 0
cc 1
rs 10
1
<?php
2
3
namespace Hafijul233\Form\Providers\Components;
4
5
use Collective\Html\FormFacade as Form;
6
use Illuminate\Support\Facades\Config;
7
use Illuminate\Support\HtmlString;
8
use Illuminate\Support\ServiceProvider;
9
10
class NormalFieldServiceProvider extends ServiceProvider
11
{
12
    /**
13
     * Register the service provider.
14
     *
15
     * @return void
16
     */
17
    public function register()
18
    {
19
        //
20
    }
21
22
    /**
23
     * Get the services provided by the provider.
24
     *
25
     * @return array
26
     */
27
    public function provides()
28
    {
29
        return [];
30
    }
31
32
    /**
33
     * Load All Normal Bootstrap Style Forms
34
     *
35
     * Example:
36
     *
37
     * Label
38
     *  +-----------------------------------+
39
     *  |            Field                  |
40
     *  +-----------------------------------+
41
     */
42
    public function boot()
43
    {
44
        $style = Config::get('form.style');
45
46
        if ($style == null) {
47
            $style = 'bootstrap4';
48
        }
49
50
        /**
51
         * @parem string $name
52
         * @parem string $label
53
         * @parem mixed $default
54
         * @parem bool $required
55
         * @parem array $attributes
56
         */
57
        Form::component('nText', 'form::'.$style.'.normal.text', ['name', 'label', 'default' => null, 'required' => false, 'attributes' => []]);
58
        /**
59
         * @parem string $name
60
         * @parem string $label
61
         * @parem mixed $default
62
         * @parem bool $required
63
         * @parem array $attributes
64
         */
65
        Form::component('nEmail', 'form::'.$style.'.normal.email', ['name', 'label', 'default' => null, 'required' => false, 'attributes' => []]);
66
67
        /**
68
         * @parem string $name
69
         * @parem string $label
70
         * @parem bool $required
71
         * @parem array $attributes
72
         */
73
        Form::component('nPassword', 'form::'.$style.'.normal.password', ['name', 'label', 'required' => false, 'attributes' => []]);
74
75
        /**
76
         * @parem string $name
77
         * @parem string $label
78
         * @parem bool $required
79
         * @parem array $attributes
80
         */
81
        Form::component('nRange', 'form::'.$style.'.normal.range', ['name', 'label', 'default' => null, 'required' => false, 'attributes' => []]);
82
83
        /**
84
         * @parem string $name
85
         * @parem string $label
86
         * @parem bool $required
87
         * @parem array $attributes
88
         */
89
        Form::component('nSearch', 'form::'.$style.'.normal.search', ['name', 'label', 'default' => null, 'required' => false, 'attributes' => []]);
90
91
        /**
92
         * @parem string $name
93
         * @parem string $label
94
         * @parem bool $required
95
         * @parem array $attributes
96
         */
97
        Form::component('nTel', 'form::'.$style.'.normal.tel', ['name', 'label', 'default' => null, 'required' => false, 'attributes' => []]);
98
99
        /**
100
         * @parem string $name
101
         * @parem string $label
102
         * @parem bool $required
103
         * @parem array $attributes
104
         */
105
        Form::component('nNumber', 'form::'.$style.'.normal.number', ['name', 'label', 'default' => null, 'required' => false, 'attributes' => []]);
106
107
        /**
108
         * @parem string $name
109
         * @parem string $label
110
         * @parem bool $required
111
         * @parem array $attributes
112
         */
113
        Form::component('nDate', 'form::'.$style.'.normal.date', ['name', 'label', 'default' => date('Y-m-d'), 'required' => false, 'attributes' => []]);
114
115
        /**
116
         * @parem string $name
117
         * @parem string $label
118
         * @parem bool $required
119
         * @parem array $attributes
120
         */
121
        Form::component('nUrl', 'form::'.$style.'.normal.url', ['name', 'label', 'default' => null, 'required' => false, 'attributes' => []]);
122
123
        /**
124
         * @parem string $name
125
         * @parem string $label
126
         * @parem bool $required
127
         * @parem array $attributes
128
         */
129
        Form::component('nFile', 'form::'.$style.'.normal.file', ['name', 'label', 'required' => false, 'attributes' => []]);
130
131
        /**
132
         * @parem string $name
133
         * @parem string $label
134
         * @parem bool $required
135
         * @parem array $attributes
136
         */
137
        Form::component('nImage', 'form::'.$style.'.normal.image', ['name', 'label', 'required' => false, 'preview' => ['preview' => false, 'height' => 100, 'default' => '/img/logo-app.png'], 'attributes' => ['accept' => 'image/*']]);
138
139
        /**
140
         * @parem string $name
141
         * @parem string $label
142
         * @parem bool $required
143
         * @parem array $attributes
144
         */
145
        Form::component('nTextarea', 'form::'.$style.'.normal.textarea', ['name', 'label', 'default' => null, 'required' => false, 'attributes' => []]);
146
147
        /**
148
         * Create a select box field.
149
         *
150
         * @param  string  $name
151
         * @param  array  $list
152
         * @param  string|bool  $selected
153
         * @param  array  $selectAttributes
154
         * @param  array  $optionsAttributes
155
         * @param  array  $optgroupsAttributes
156
         */
157
        Form::component('nSelect', 'form::'.$style.'.normal.select', ['name', 'label', 'data' => [], 'selected', 'required' => false, 'attributes' => []]);
158
159
        /**
160
         * Create a select box field.
161
         *
162
         * @param  string  $name
163
         * @param  array  $list
164
         * @param  string|bool  $selected
165
         * @param  array  $selectAttributes
166
         * @param  array  $optionsAttributes
167
         * @param  array  $optgroupsAttributes
168
         */
169
        Form::component('nSelectMulti', 'form::'.$style.'.normal.selectmulti', ['name', 'label', 'data' => [], 'selected' => [], 'required' => false, 'attributes' => []]);
170
171
        /**
172
         * Create a select range field.
173
         *
174
         * @param  string  $name
175
         * @param  string  $begin
176
         * @param  string  $end
177
         * @param  string  $selected
178
         * @param  array  $options
179
         * @return HtmlString
180
         */
181
        Form::component('nSelectRange', 'form::'.$style.'.normal.selectrange', ['name', 'label', 'begin', 'end', 'selected', 'required' => false, 'attributes' => []]);
182
183
        /**
184
         * Create a select month field.
185
         *
186
         * @param  string  $name
187
         * @param  string  $selected
188
         * @param  array  $options
189
         * @param  string  $format
190
         * @return HtmlString
191
         */
192
        Form::component('nSelectMonth', 'form::'.$style.'.normal.selectmonth', ['name', 'label', 'selected' => null, 'required' => false, 'attributes' => []]);
193
194
        /**
195
         * Create a checkbox input field.
196
         *
197
         * @param  string  $name
198
         * @param  mixed  $value
199
         * @param  bool  $checked
200
         * @param  array  $options
201
         * @return HtmlString
202
         */
203
        Form::component('nCheckbox', 'form::'.$style.'.normal.checkbox', ['name', 'label', 'values' => [], 'checked' => [], 'required' => false, 'attributes' => []]);
204
205
        /**
206
         * Create a radio button input field.
207
         *
208
         * @param  string  $name
209
         * @param  mixed  $value
210
         * @param  bool  $checked
211
         * @param  array  $options
212
         * @return HtmlString
213
         */
214
        Form::component('nRadio', 'form::'.$style.'.normal.radio', ['name', 'label', 'values' => [], 'checked' => null, 'required' => false, 'attributes' => []]);
215
    }
216
}
217