@@ -34,7 +34,7 @@ discard block |
||
34 | 34 | */ |
35 | 35 | protected function getErrorBag(string $bag = 'default'): MessageBag |
36 | 36 | { |
37 | - $bags = View::shared('errors', fn () => request()->session()->get('errors', new ViewErrorBag)); |
|
37 | + $bags = View::shared('errors', fn() => request()->session()->get('errors', new ViewErrorBag)); |
|
38 | 38 | |
39 | 39 | return $bags->getBag($bag); |
40 | 40 | } |
@@ -48,7 +48,7 @@ discard block |
||
48 | 48 | */ |
49 | 49 | public function hasError(string $name, string $bag = 'default'): bool |
50 | 50 | { |
51 | - $name = str_replace(['[', ']'], ['.', ''], Str::before($name, '[]')); |
|
51 | + $name = str_replace([ '[', ']' ], [ '.', '' ], Str::before($name, '[]')); |
|
52 | 52 | |
53 | 53 | $errorBag = $this->getErrorBag($bag); |
54 | 54 |
@@ -27,7 +27,7 @@ discard block |
||
27 | 27 | { |
28 | 28 | $this->method = strtoupper($method); |
29 | 29 | |
30 | - $this->spoofMethod = in_array($this->method, ['PUT', 'PATCH', 'DELETE']); |
|
30 | + $this->spoofMethod = in_array($this->method, [ 'PUT', 'PATCH', 'DELETE' ]); |
|
31 | 31 | } |
32 | 32 | |
33 | 33 | /** |
@@ -38,7 +38,7 @@ discard block |
||
38 | 38 | */ |
39 | 39 | public function hasError($bag = 'default'): bool |
40 | 40 | { |
41 | - $errors = View::shared('errors', fn () => request()->session()->get('errors', new ViewErrorBag)); |
|
41 | + $errors = View::shared('errors', fn() => request()->session()->get('errors', new ViewErrorBag)); |
|
42 | 42 | |
43 | 43 | return $errors->getBag($bag)->isNotEmpty(); |
44 | 44 | } |
@@ -26,7 +26,7 @@ |
||
26 | 26 | public function __construct( |
27 | 27 | string $name, |
28 | 28 | string $label = '', |
29 | - $options = [], |
|
29 | + $options = [ ], |
|
30 | 30 | $bind = null, |
31 | 31 | $default = null, |
32 | 32 | bool $multiple = false, |
@@ -26,7 +26,7 @@ discard block |
||
26 | 26 | |
27 | 27 | $framework = config("form-components.framework"); |
28 | 28 | |
29 | - return str_replace('{framework}', $framework, $config['view']); |
|
29 | + return str_replace('{framework}', $framework, $config[ 'view' ]); |
|
30 | 30 | } |
31 | 31 | |
32 | 32 | /** |
@@ -97,6 +97,6 @@ discard block |
||
97 | 97 | */ |
98 | 98 | protected static function convertBracketsToDots($name): string |
99 | 99 | { |
100 | - return str_replace(['[', ']'], ['.', ''], $name); |
|
100 | + return str_replace([ '[', ']' ], [ '.', '' ], $name); |
|
101 | 101 | } |
102 | 102 | } |
@@ -82,14 +82,14 @@ |
||
82 | 82 | return $date; |
83 | 83 | } |
84 | 84 | |
85 | - $cast = $model->getCasts()[$key] ?? null; |
|
85 | + $cast = $model->getCasts()[ $key ] ?? null; |
|
86 | 86 | |
87 | 87 | if (!$cast || $cast === 'date' || $cast === 'datetime') { |
88 | 88 | return Carbon::instance($date)->toJSON(); |
89 | 89 | } |
90 | 90 | |
91 | 91 | if ($this->isCustomDateTimeCast($cast)) { |
92 | - return $date->format(explode(':', $cast, 2)[1]); |
|
92 | + return $date->format(explode(':', $cast, 2)[ 1 ]); |
|
93 | 93 | } |
94 | 94 | |
95 | 95 | return $date; |
@@ -28,19 +28,19 @@ discard block |
||
28 | 28 | |
29 | 29 | // |
30 | 30 | |
31 | - Blade::directive('bind', function ($bind) { |
|
31 | + Blade::directive('bind', function($bind) { |
|
32 | 32 | return '<?php app(\ProtoneMedia\LaravelFormComponents\FormDataBinder::class)->bind(' . $bind . '); ?>'; |
33 | 33 | }); |
34 | 34 | |
35 | - Blade::directive('endbind', function () { |
|
35 | + Blade::directive('endbind', function() { |
|
36 | 36 | return '<?php app(\ProtoneMedia\LaravelFormComponents\FormDataBinder::class)->pop(); ?>'; |
37 | 37 | }); |
38 | 38 | |
39 | - Blade::directive('wire', function ($modifier) { |
|
39 | + Blade::directive('wire', function($modifier) { |
|
40 | 40 | return '<?php app(\ProtoneMedia\LaravelFormComponents\FormDataBinder::class)->wire(' . $modifier . '); ?>'; |
41 | 41 | }); |
42 | 42 | |
43 | - Blade::directive('endwire', function () { |
|
43 | + Blade::directive('endwire', function() { |
|
44 | 44 | return '<?php app(\ProtoneMedia\LaravelFormComponents\FormDataBinder::class)->endWire(); ?>'; |
45 | 45 | }); |
46 | 46 | |
@@ -49,7 +49,7 @@ discard block |
||
49 | 49 | $prefix = config('form-components.prefix'); |
50 | 50 | |
51 | 51 | Collection::make(config('form-components.components'))->each( |
52 | - fn ($component, $alias) => Blade::component($alias, $component['class'], $prefix) |
|
52 | + fn($component, $alias) => Blade::component($alias, $component[ 'class' ], $prefix) |
|
53 | 53 | ); |
54 | 54 | } |
55 | 55 | |
@@ -60,6 +60,6 @@ discard block |
||
60 | 60 | { |
61 | 61 | $this->mergeConfigFrom(__DIR__ . '/../../config/config.php', 'form-components'); |
62 | 62 | |
63 | - $this->app->singleton(FormDataBinder::class, fn () => new FormDataBinder); |
|
63 | + $this->app->singleton(FormDataBinder::class, fn() => new FormDataBinder); |
|
64 | 64 | } |
65 | 65 | } |
@@ -9,7 +9,7 @@ discard block |
||
9 | 9 | /** |
10 | 10 | * Tree of bound targets. |
11 | 11 | */ |
12 | - private array $bindings = []; |
|
12 | + private array $bindings = [ ]; |
|
13 | 13 | |
14 | 14 | /** |
15 | 15 | * Wired to a Livewire component. |
@@ -24,7 +24,7 @@ discard block |
||
24 | 24 | */ |
25 | 25 | public function bind($target): void |
26 | 26 | { |
27 | - $this->bindings[] = $target; |
|
27 | + $this->bindings[ ] = $target; |
|
28 | 28 | } |
29 | 29 | |
30 | 30 | /** |