InlineFieldServiceProvider::provides()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

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