1
+ <?php
2
+ namespace App \Services ;
3
+
4
+ class CrudInput
5
+ {
6
+ public static function text ( $ label , $ name , $ validation = '' , $ description = '' , $ readonly = false , $ type = 'text ' )
7
+ {
8
+ return compact ( 'label ' , 'name ' , 'validation ' , 'description ' , 'readonly ' , 'type ' );
9
+ }
10
+
11
+ public static function password ( $ label , $ name , $ validation = '' , $ description = '' , $ readonly = false )
12
+ {
13
+ return self ::text (
14
+ label: $ label ,
15
+ name: $ name ,
16
+ validation: $ validation ,
17
+ description: $ description ,
18
+ readonly: $ readonly ,
19
+ type: 'password '
20
+ );
21
+ }
22
+
23
+ public static function email ( $ label , $ name , $ validation = '' , $ description = '' , $ readonly = false )
24
+ {
25
+ return self ::text (
26
+ label: $ label ,
27
+ name: $ name ,
28
+ validation: $ validation ,
29
+ description: $ description ,
30
+ readonly: $ readonly ,
31
+ type: 'email '
32
+ );
33
+ }
34
+
35
+ public static function number ( $ label , $ name , $ validation = '' , $ description = '' , $ readonly = false , $ type = 'number ' )
36
+ {
37
+ return self ::text (
38
+ label: $ label ,
39
+ name: $ name ,
40
+ validation: $ validation ,
41
+ description: $ description ,
42
+ readonly: $ readonly ,
43
+ type: 'number '
44
+ );
45
+ }
46
+
47
+ public static function tel ( $ label , $ name , $ validation = '' , $ description = '' , $ readonly = false , $ type = 'tel ' )
48
+ {
49
+ return self ::text (
50
+ label: $ label ,
51
+ name: $ name ,
52
+ validation: $ validation ,
53
+ description: $ description ,
54
+ readonly: $ readonly ,
55
+ type: 'tel '
56
+ );
57
+ }
58
+
59
+ public static function hidden ( $ label , $ name , $ validation = '' , $ description = '' , $ readonly = false , $ type = 'hidden ' )
60
+ {
61
+ return self ::text (
62
+ label: $ label ,
63
+ name: $ name ,
64
+ validation: $ validation ,
65
+ description: $ description ,
66
+ readonly: $ readonly ,
67
+ type: 'hidden '
68
+ );
69
+ }
70
+
71
+ public static function date ( $ label , $ name , $ validation = '' , $ description = '' , $ readonly = false , $ type = 'date ' )
72
+ {
73
+ return self ::text (
74
+ label: $ label ,
75
+ name: $ name ,
76
+ validation: $ validation ,
77
+ description: $ description ,
78
+ readonly: $ readonly ,
79
+ type: 'date '
80
+ );
81
+ }
82
+
83
+ public static function select ( $ label , $ name , $ options , $ validation = '' , $ description = '' , $ readonly = false , $ type = 'text ' )
84
+ {
85
+ return compact ( 'label ' , 'name ' , 'validation ' , 'options ' , 'description ' , 'readonly ' , 'type ' );
86
+ }
87
+
88
+ public static function searchSelect ( $ label , $ name , $ options = [], $ validation = '' , $ description = '' , $ readonly = false )
89
+ {
90
+ return self ::select (
91
+ label: $ label ,
92
+ name: $ name ,
93
+ validation: $ validation ,
94
+ description: $ description ,
95
+ options: $ options ,
96
+ type: 'search-select ' ,
97
+ );
98
+ }
99
+
100
+ public static function textarea ( $ label , $ name , $ validation = '' , $ description = '' , $ readonly = false )
101
+ {
102
+ return self ::text (
103
+ label: $ label ,
104
+ name: $ name ,
105
+ validation: $ validation ,
106
+ description: $ description ,
107
+ readonly: $ readonly ,
108
+ type: 'textarea '
109
+ );
110
+ }
111
+
112
+ public static function checkbox ( $ label , $ name , $ validation = '' , $ description = '' , $ readonly = false )
113
+ {
114
+ return self ::text (
115
+ label: $ label ,
116
+ name: $ name ,
117
+ validation: $ validation ,
118
+ description: $ description ,
119
+ readonly: $ readonly ,
120
+ type: 'checkbox '
121
+ );
122
+ }
123
+
124
+ public static function multiselect ( $ label , $ name , $ options , $ validation = '' , $ description = '' , $ readonly = false )
125
+ {
126
+ return self ::select (
127
+ label: $ label ,
128
+ name: $ name ,
129
+ validation: $ validation ,
130
+ options: $ options ,
131
+ description: $ description ,
132
+ readonly: $ readonly ,
133
+ type: 'multiselect '
134
+ );
135
+ }
136
+
137
+ public static function inlineMultiselect ( $ label , $ name , $ options , $ validation = '' , $ description = '' , $ readonly = false )
138
+ {
139
+ return self ::select (
140
+ label: $ label ,
141
+ name: $ name ,
142
+ validation: $ validation ,
143
+ options: $ options ,
144
+ description: $ description ,
145
+ readonly: $ readonly ,
146
+ type: 'inline-multiselect '
147
+ );
148
+ }
149
+
150
+ public static function selectAudio ( $ label , $ name , $ options , $ validation = '' , $ description = '' , $ readonly = false )
151
+ {
152
+ return self ::select (
153
+ label: $ label ,
154
+ name: $ name ,
155
+ validation: $ validation ,
156
+ options: $ options ,
157
+ description: $ description ,
158
+ readonly: $ readonly ,
159
+ type: 'select-audio '
160
+ );
161
+ }
162
+
163
+ public static function switch ( $ label , $ name , $ options , $ validation = '' , $ description = '' , $ readonly = false )
164
+ {
165
+ return self ::select (
166
+ label: $ label ,
167
+ name: $ name ,
168
+ validation: $ validation ,
169
+ options: $ options ,
170
+ description: $ description ,
171
+ readonly: $ readonly ,
172
+ type: 'switch '
173
+ );
174
+ }
175
+
176
+ public static function media ( $ label , $ name , $ validation = '' , $ description = '' , $ readonly = false )
177
+ {
178
+ return self ::text (
179
+ label: $ label ,
180
+ name: $ name ,
181
+ validation: $ validation ,
182
+ description: $ description ,
183
+ readonly: $ readonly ,
184
+ type: 'media '
185
+ );
186
+ }
187
+
188
+ public static function ckeditor ( $ label , $ name , $ validation = '' , $ description = '' , $ readonly = false )
189
+ {
190
+ return self ::text (
191
+ label: $ label ,
192
+ name: $ name ,
193
+ validation: $ validation ,
194
+ description: $ description ,
195
+ readonly: $ readonly ,
196
+ type: 'ckeditor '
197
+ );
198
+ }
199
+
200
+ public static function datetime ( $ label , $ name , $ validation = '' , $ description = '' , $ readonly = false )
201
+ {
202
+ return self ::text (
203
+ label: $ label ,
204
+ name: $ name ,
205
+ validation: $ validation ,
206
+ description: $ description ,
207
+ readonly: $ readonly ,
208
+ type: 'datetimepicker '
209
+ );
210
+ }
211
+
212
+ public static function daterange ( $ label , $ name , $ validation = '' , $ description = '' , $ readonly = false )
213
+ {
214
+ return self ::text (
215
+ label: $ label ,
216
+ name: $ name ,
217
+ validation: $ validation ,
218
+ description: $ description ,
219
+ readonly: $ readonly ,
220
+ type: 'daterangepicker '
221
+ );
222
+ }
223
+
224
+ public static function custom ( $ label , $ name , $ type , $ validation = '' , $ description = '' , $ readonly = false , $ options = [] )
225
+ {
226
+ return self ::select (
227
+ label: $ label ,
228
+ name: $ name ,
229
+ validation: $ validation ,
230
+ description: $ description ,
231
+ readonly: $ readonly ,
232
+ options: $ options ,
233
+ type: $ type
234
+ );
235
+ }
236
+ }
0 commit comments