@@ -15,7 +15,7 @@ discard block |
||
15 | 15 | { |
16 | 16 | return call_user_func_array( |
17 | 17 | 'array_merge', |
18 | - array_map(function ($u, $v) use ($b, $c) { |
|
18 | + array_map(function($u, $v) use ($b, $c) { |
|
19 | 19 | return ["{$b}{$c}{$u}" => $v]; |
20 | 20 | }, array_keys($a), array_values($a)) |
21 | 21 | ); |
@@ -47,7 +47,7 @@ discard block |
||
47 | 47 | if (!function_exists('Encore\Admin\Form\Field\array_key_clean')) { |
48 | 48 | function array_key_clean(array $a) |
49 | 49 | { |
50 | - $a = count($a) ? call_user_func_array('array_merge', array_map(function ($k, $v) { |
|
50 | + $a = count($a) ? call_user_func_array('array_merge', array_map(function($k, $v) { |
|
51 | 51 | return [str_replace(':', '', $k) => $v]; |
52 | 52 | }, array_keys($a), array_values($a))) : $a; |
53 | 53 | |
@@ -151,7 +151,7 @@ discard block |
||
151 | 151 | $rel = $this->relationName; |
152 | 152 | $rules = $attributes = $messages = $newInputs = []; |
153 | 153 | // remove all inputs & keys marked as removed |
154 | - $availInput = array_filter(array_map(function ($v) { |
|
154 | + $availInput = array_filter(array_map(function($v) { |
|
155 | 155 | return $v[NestedForm::REMOVE_FLAG_NAME] ? null : $v; |
156 | 156 | }, $input[$rel])); |
157 | 157 | $keys = array_keys($availInput); |
@@ -178,15 +178,15 @@ discard block |
||
178 | 178 | } |
179 | 179 | } |
180 | 180 | |
181 | - $newColumn = call_user_func_array('array_merge', array_map(function ($u) use ($columns, $rel) { |
|
182 | - return array_map(function ($k, $v) use ($u, $rel) { |
|
181 | + $newColumn = call_user_func_array('array_merge', array_map(function($u) use ($columns, $rel) { |
|
182 | + return array_map(function($k, $v) use ($u, $rel) { |
|
183 | 183 | //Fix ResetInput Function! A Headache Implementation! |
184 | 184 | return $k ? "{$rel}.{$u}.{$v}:{$k}" : "{$rel}.{$u}.{$v}"; |
185 | 185 | }, array_keys($columns), array_values($columns)); |
186 | 186 | }, $keys)); |
187 | 187 | |
188 | 188 | if ($field instanceof Field\Embeds) { |
189 | - $newRules = array_map(function ($v) use ($availInput, $field) { |
|
189 | + $newRules = array_map(function($v) use ($availInput, $field) { |
|
190 | 190 | list($r, $k, $c) = explode('.', $v); |
191 | 191 | $v = "{$r}.{$k}"; |
192 | 192 | $embed = $field->getValidationRules([$field->column() => $availInput[$k][$c]]); |
@@ -195,7 +195,7 @@ discard block |
||
195 | 195 | }, $newColumn); |
196 | 196 | $rules = array_clean_merge($rules, array_filter($newRules)); |
197 | 197 | |
198 | - $newAttributes = array_map(function ($v) use ($availInput, $field) { |
|
198 | + $newAttributes = array_map(function($v) use ($availInput, $field) { |
|
199 | 199 | list($r, $k, $c) = explode('.', $v); |
200 | 200 | $v = "{$r}.{$k}"; |
201 | 201 | $embed = $field->getValidationAttributes([$field->column() => $availInput[$k][$c]]); |
@@ -204,7 +204,7 @@ discard block |
||
204 | 204 | }, $newColumn); |
205 | 205 | $attributes = array_clean_merge($attributes, array_filter($newAttributes)); |
206 | 206 | |
207 | - $newInput = array_map(function ($v) use ($availInput, $field) { |
|
207 | + $newInput = array_map(function($v) use ($availInput, $field) { |
|
208 | 208 | list($r, $k, $c) = explode('.', $v); |
209 | 209 | $v = "{$r}.{$k}"; |
210 | 210 | $embed = $field->getValidationInput([$field->column() => $availInput[$k][$c]]); |
@@ -213,7 +213,7 @@ discard block |
||
213 | 213 | }, $newColumn); |
214 | 214 | $newInputs = array_clean_merge($newInputs, array_filter($newInput, 'strlen', ARRAY_FILTER_USE_KEY)); |
215 | 215 | |
216 | - $newMessages = array_map(function ($v) use ($availInput, $field) { |
|
216 | + $newMessages = array_map(function($v) use ($availInput, $field) { |
|
217 | 217 | list($r, $k, $c) = explode('.', $v); |
218 | 218 | $v = "{$r}.{$k}"; |
219 | 219 | $embed = $field->getValidationMessages([$field->column() => $availInput[$k][$c]]); |
@@ -223,7 +223,7 @@ discard block |
||
223 | 223 | $messages = array_clean_merge($messages, array_filter($newMessages)); |
224 | 224 | } else { |
225 | 225 | $fieldRules = is_array($fieldRules) ? implode('|', $fieldRules) : $fieldRules; |
226 | - $newRules = array_map(function ($v) use ($fieldRules, $availInput) { |
|
226 | + $newRules = array_map(function($v) use ($fieldRules, $availInput) { |
|
227 | 227 | list($r, $k, $c) = explode('.', $v); |
228 | 228 | //Fix ResetInput Function! A Headache Implementation! |
229 | 229 | $col = explode(':', $c)[0]; |
@@ -235,7 +235,7 @@ discard block |
||
235 | 235 | }, $newColumn); |
236 | 236 | $rules = array_clean_merge($rules, $newRules); |
237 | 237 | |
238 | - $newInput = array_map(function ($v) use ($availInput) { |
|
238 | + $newInput = array_map(function($v) use ($availInput) { |
|
239 | 239 | list($r, $k, $c) = explode('.', $v); |
240 | 240 | //Fix ResetInput Function! A Headache Implementation! |
241 | 241 | $col = explode(':', $c)[0]; |
@@ -251,12 +251,12 @@ discard block |
||
251 | 251 | }, $newColumn); |
252 | 252 | $newInputs = array_clean_merge($newInputs, $newInput); |
253 | 253 | |
254 | - $newAttributes = array_map(function ($v) use ($field, $availInput) { |
|
254 | + $newAttributes = array_map(function($v) use ($field, $availInput) { |
|
255 | 255 | list($r, $k, $c) = explode('.', $v); |
256 | 256 | //Fix ResetInput Function! A Headache Implementation! |
257 | 257 | $col = explode(':', $c)[0]; |
258 | 258 | if (array_key_exists($col, $availInput[$k]) && is_array($availInput[$k][$col])) { |
259 | - return call_user_func_array('array_merge', array_map(function ($u) use ($v, $field) { |
|
259 | + return call_user_func_array('array_merge', array_map(function($u) use ($v, $field) { |
|
260 | 260 | $w = $field->label(); |
261 | 261 | //Fix ResetInput Function! A Headache Implementation! |
262 | 262 | $w .= is_array($field->column()) ? '['.explode(':', explode('.', $v)[2])[0].']' : ''; |
@@ -275,12 +275,12 @@ discard block |
||
275 | 275 | } |
276 | 276 | |
277 | 277 | if ($field->validationMessages) { |
278 | - $newMessages = array_map(function ($v) use ($field, $availInput) { |
|
278 | + $newMessages = array_map(function($v) use ($field, $availInput) { |
|
279 | 279 | list($r, $k, $c) = explode('.', $v); |
280 | 280 | //Fix ResetInput Function! A Headache Implementation! |
281 | 281 | $col = explode(':', $c)[0]; |
282 | 282 | if (array_key_exists($col, $availInput[$k]) && is_array($availInput[$k][$col])) { |
283 | - return call_user_func_array('array_merge', array_map(function ($u) use ($v, $field) { |
|
283 | + return call_user_func_array('array_merge', array_map(function($u) use ($v, $field) { |
|
284 | 284 | return array_key_attach_str($field->validationMessages, "{$v}:{$u}"); |
285 | 285 | }, array_keys($availInput[$k][$col]))); |
286 | 286 | } |
@@ -688,7 +688,7 @@ discard block |
||
688 | 688 | } |
689 | 689 | |
690 | 690 | /* Build row elements */ |
691 | - $template = array_reduce($fields, function ($all, $field) { |
|
691 | + $template = array_reduce($fields, function($all, $field) { |
|
692 | 692 | $all .= "<td>{$field}</td>"; |
693 | 693 | |
694 | 694 | return $all; |
@@ -11,7 +11,7 @@ discard block |
||
11 | 11 | { |
12 | 12 | return call_user_func_array( |
13 | 13 | 'array_merge', |
14 | - array_map(function ($u, $v) use ($b, $c) { |
|
14 | + array_map(function($u, $v) use ($b, $c) { |
|
15 | 15 | return ["{$b}{$c}{$u}" => $v]; |
16 | 16 | }, array_keys($a), array_values($a)) |
17 | 17 | ); |
@@ -43,7 +43,7 @@ discard block |
||
43 | 43 | if (!function_exists('array_key_clean')) { |
44 | 44 | function array_key_clean(array $a) |
45 | 45 | { |
46 | - $a = count($a) ? call_user_func_array('array_merge', array_map(function ($k, $v) { |
|
46 | + $a = count($a) ? call_user_func_array('array_merge', array_map(function($k, $v) { |
|
47 | 47 | return [str_replace(':', '', $k) => $v]; |
48 | 48 | }, array_keys($a), array_values($a))) : $a; |
49 | 49 | |
@@ -156,13 +156,13 @@ discard block |
||
156 | 156 | * 'extra.end_atend' => "$label[end_at]" |
157 | 157 | * ] |
158 | 158 | */ |
159 | - $newColumn = array_map(function ($k, $v) use ($rel) { |
|
159 | + $newColumn = array_map(function($k, $v) use ($rel) { |
|
160 | 160 | //Fix ResetInput Function! A Headache Implementation! |
161 | 161 | return !$k ? "{$rel}.{$v}" : "{$rel}.{$v}:{$k}"; |
162 | 162 | }, array_keys($columns), array_values($columns)); |
163 | 163 | |
164 | 164 | $fieldRules = is_array($fieldRules) ? implode('|', $fieldRules) : $fieldRules; |
165 | - $newRules = array_map(function ($v) use ($fieldRules, $availInput) { |
|
165 | + $newRules = array_map(function($v) use ($fieldRules, $availInput) { |
|
166 | 166 | list($k, $c) = explode('.', $v); |
167 | 167 | //Fix ResetInput Function! A Headache Implementation! |
168 | 168 | $col = explode(':', $c)[0]; |
@@ -243,17 +243,17 @@ discard block |
||
243 | 243 | * 'extra.end_atend' => "$label[end_at]" |
244 | 244 | * ] |
245 | 245 | */ |
246 | - $newColumn = array_map(function ($k, $v) use ($rel) { |
|
246 | + $newColumn = array_map(function($k, $v) use ($rel) { |
|
247 | 247 | //Fix ResetInput Function! A Headache Implementation! |
248 | 248 | return !$k ? "{$rel}.{$v}" : "{$rel}.{$v}:{$k}"; |
249 | 249 | }, array_keys($columns), array_values($columns)); |
250 | 250 | |
251 | - $newAttributes = array_map(function ($v) use ($field, $availInput) { |
|
251 | + $newAttributes = array_map(function($v) use ($field, $availInput) { |
|
252 | 252 | list($k, $c) = explode('.', $v); |
253 | 253 | //Fix ResetInput Function! A Headache Implementation! |
254 | 254 | $col = explode(':', $c)[0]; |
255 | 255 | if (array_key_exists($col, $availInput[$k]) && is_array($availInput[$k][$col])) { |
256 | - return call_user_func_array('array_merge', array_map(function ($u) use ($v, $field) { |
|
256 | + return call_user_func_array('array_merge', array_map(function($u) use ($v, $field) { |
|
257 | 257 | $w = $field->label(); |
258 | 258 | //Fix ResetInput Function! A Headache Implementation! |
259 | 259 | $w .= is_array($field->column()) ? '['.explode(':', explode('.', $v)[2])[0].']' : ''; |
@@ -332,12 +332,12 @@ discard block |
||
332 | 332 | * 'extra.end_atend' => $value |
333 | 333 | * ] |
334 | 334 | */ |
335 | - $newColumn = array_map(function ($k, $v) use ($rel) { |
|
335 | + $newColumn = array_map(function($k, $v) use ($rel) { |
|
336 | 336 | //Fix ResetInput Function! A Headache Implementation! |
337 | 337 | return !$k ? "{$rel}.{$v}" : "{$rel}.{$v}:{$k}"; |
338 | 338 | }, array_keys($columns), array_values($columns)); |
339 | 339 | |
340 | - $newInput = array_map(function ($v) use ($availInput) { |
|
340 | + $newInput = array_map(function($v) use ($availInput) { |
|
341 | 341 | list($k, $c) = explode('.', $v); |
342 | 342 | //Fix ResetInput Function! A Headache Implementation! |
343 | 343 | $col = explode(':', $c)[0]; |
@@ -395,20 +395,20 @@ discard block |
||
395 | 395 | $availInput[$column] = $availInput[$column] ?: null; |
396 | 396 | } |
397 | 397 | |
398 | - $newColumn = array_map(function ($k, $v) use ($rel) { |
|
398 | + $newColumn = array_map(function($k, $v) use ($rel) { |
|
399 | 399 | //Fix ResetInput Function! A Headache Implementation! |
400 | 400 | return !$k ? "{$rel}.{$v}" : "{$rel}.{$v}:{$k}"; |
401 | 401 | }, array_keys($columns), array_values($columns)); |
402 | 402 | |
403 | 403 | if ($field->validationMessages) { |
404 | - $newMessages = array_map(function ($v) use ($field, $availInput) { |
|
404 | + $newMessages = array_map(function($v) use ($field, $availInput) { |
|
405 | 405 | list($k, $c) = explode('.', $v); |
406 | 406 | //Fix ResetInput Function! A Headache Implementation! |
407 | 407 | $col = explode(':', $c)[0]; |
408 | 408 | if (array_key_exists($col, $availInput[$k]) && is_array($availInput[$k][$col])) { |
409 | 409 | return call_user_func_array( |
410 | 410 | 'array_merge', |
411 | - array_map(function ($u) use ( |
|
411 | + array_map(function($u) use ( |
|
412 | 412 | $v, |
413 | 413 | $field |
414 | 414 | ) { |
@@ -495,7 +495,7 @@ discard block |
||
495 | 495 | //Fix the Bug of Embeds Fields Cannot be used within HasMany |
496 | 496 | if ($this->elementName) { |
497 | 497 | list($rel, $key, $col) = explode('.', $this->errorKey); |
498 | - $form->fields()->each(function (Field $field) use ($rel, $key, $col) { |
|
498 | + $form->fields()->each(function(Field $field) use ($rel, $key, $col) { |
|
499 | 499 | $column = $field->column(); |
500 | 500 | $elementName = $elementClass = $errorKey = []; |
501 | 501 | if (is_array($column)) { |
@@ -61,7 +61,7 @@ discard block |
||
61 | 61 | if (is_callable($options)) { |
62 | 62 | $this->options = $options; |
63 | 63 | } else { |
64 | - $this->options = (array)$options; |
|
64 | + $this->options = (array) $options; |
|
65 | 65 | } |
66 | 66 | |
67 | 67 | return $this; |
@@ -147,12 +147,12 @@ discard block |
||
147 | 147 | |
148 | 148 | return implode( |
149 | 149 | ",\n", |
150 | - array_map(function ($u, $v) use ($functions) { |
|
150 | + array_map(function($u, $v) use ($functions) { |
|
151 | 151 | if (is_string($v)) { |
152 | 152 | return in_array($u, $functions) ? "{$u}: {$v}" : "{$u}: \"{$v}\""; |
153 | 153 | } |
154 | 154 | |
155 | - return "{$u}: " . json_encode($v); |
|
155 | + return "{$u}: ".json_encode($v); |
|
156 | 156 | }, array_keys($options), $options) |
157 | 157 | ); |
158 | 158 | } |
@@ -174,7 +174,7 @@ discard block |
||
174 | 174 | ); |
175 | 175 | $configs = $this->buildJsJson($configs); |
176 | 176 | |
177 | - return $quoted ? '{' . $configs . '}' : $configs; |
|
177 | + return $quoted ? '{'.$configs.'}' : $configs; |
|
178 | 178 | } |
179 | 179 | |
180 | 180 | /** |
@@ -291,7 +291,7 @@ discard block |
||
291 | 291 | throw new \InvalidArgumentException("[$model] must be a valid model class"); |
292 | 292 | } |
293 | 293 | |
294 | - $this->options = function ($value) use ($model, $idField, $textField) { |
|
294 | + $this->options = function($value) use ($model, $idField, $textField) { |
|
295 | 295 | if (empty($value)) { |
296 | 296 | return []; |
297 | 297 | } |
@@ -326,7 +326,7 @@ discard block |
||
326 | 326 | protected function loadRemoteOptions($url, $parameters = [], $options = []) |
327 | 327 | { |
328 | 328 | $ajaxOptions = [ |
329 | - 'url' => $url . '?' . http_build_query($parameters), |
|
329 | + 'url' => $url.'?'.http_build_query($parameters), |
|
330 | 330 | ]; |
331 | 331 | |
332 | 332 | $configs = $this->configs([ |
@@ -442,7 +442,7 @@ discard block |
||
442 | 442 | */ |
443 | 443 | public function render() |
444 | 444 | { |
445 | - Admin::js('https://cdnjs.cloudflare.com/ajax/libs/select2/4.0.3/js/i18n/' . app()->getLocale() . '.js'); |
|
445 | + Admin::js('https://cdnjs.cloudflare.com/ajax/libs/select2/4.0.3/js/i18n/'.app()->getLocale().'.js'); |
|
446 | 446 | $configs = str_replace("\n", "", $this->configs( |
447 | 447 | [ |
448 | 448 | 'allowClear' => true, |
@@ -475,7 +475,7 @@ discard block |
||
475 | 475 | 'groups' => $this->groups, |
476 | 476 | ]); |
477 | 477 | |
478 | - $this->attribute('data-value', implode(',', (array)$this->value())); |
|
478 | + $this->attribute('data-value', implode(',', (array) $this->value())); |
|
479 | 479 | |
480 | 480 | return parent::render(); |
481 | 481 | } |