We could not synchronize checks via GitHub's checks API since Scrutinizer's GitHub App is not installed for this repository.
@@ -19,8 +19,8 @@ discard block |
||
19 | 19 | * - when true: `address[street]` |
20 | 20 | * - when false: `[address][street]` |
21 | 21 | */ |
22 | -if (! Str::hasMacro('dotsToSquareBrackets')) { |
|
23 | - Str::macro('dotsToSquareBrackets', function ($string, $ignore = [], $keyFirst = true) { |
|
22 | +if (!Str::hasMacro('dotsToSquareBrackets')) { |
|
23 | + Str::macro('dotsToSquareBrackets', function($string, $ignore = [], $keyFirst = true) { |
|
24 | 24 | $stringParts = explode('.', $string); |
25 | 25 | $result = ''; |
26 | 26 | |
@@ -34,8 +34,8 @@ discard block |
||
34 | 34 | return $result; |
35 | 35 | }); |
36 | 36 | } |
37 | -if (! CrudColumn::hasMacro('withFiles')) { |
|
38 | - CrudColumn::macro('withFiles', function ($uploadDefinition = [], $subfield = null, $registerUploaderEvents = true) { |
|
37 | +if (!CrudColumn::hasMacro('withFiles')) { |
|
38 | + CrudColumn::macro('withFiles', function($uploadDefinition = [], $subfield = null, $registerUploaderEvents = true) { |
|
39 | 39 | /** @var CrudColumn $this */ |
40 | 40 | $uploadDefinition = is_array($uploadDefinition) ? $uploadDefinition : []; |
41 | 41 | $this->setAttributeValue('withFiles', $uploadDefinition); |
@@ -46,8 +46,8 @@ discard block |
||
46 | 46 | }); |
47 | 47 | } |
48 | 48 | |
49 | -if (! CrudField::hasMacro('withFiles')) { |
|
50 | - CrudField::macro('withFiles', function ($uploadDefinition = [], $subfield = null, $registerUploaderEvents = true) { |
|
49 | +if (!CrudField::hasMacro('withFiles')) { |
|
50 | + CrudField::macro('withFiles', function($uploadDefinition = [], $subfield = null, $registerUploaderEvents = true) { |
|
51 | 51 | /** @var CrudField $this */ |
52 | 52 | $uploadDefinition = is_array($uploadDefinition) ? $uploadDefinition : []; |
53 | 53 | $this->setAttributeValue('withFiles', $uploadDefinition); |
@@ -58,8 +58,8 @@ discard block |
||
58 | 58 | }); |
59 | 59 | } |
60 | 60 | |
61 | -if (! CrudColumn::hasMacro('linkTo')) { |
|
62 | - CrudColumn::macro('linkTo', function (string|array|Closure $routeOrConfiguration, ?array $parameters = []): static { |
|
61 | +if (!CrudColumn::hasMacro('linkTo')) { |
|
62 | + CrudColumn::macro('linkTo', function(string | array | Closure $routeOrConfiguration, ?array $parameters = []): static { |
|
63 | 63 | $wrapper = $this->attributes['wrapper'] ?? []; |
64 | 64 | |
65 | 65 | // parse the function input to get the actual route and parameters we'll be working with |
@@ -72,7 +72,7 @@ discard block |
||
72 | 72 | |
73 | 73 | // if the route is a closure, we'll just call it |
74 | 74 | if ($route instanceof Closure) { |
75 | - $wrapper['href'] = function ($crud, $column, $entry, $related_key) use ($route) { |
|
75 | + $wrapper['href'] = function($crud, $column, $entry, $related_key) use ($route) { |
|
76 | 76 | return $route($entry, $related_key, $column, $crud); |
77 | 77 | }; |
78 | 78 | $this->wrapper($wrapper); |
@@ -81,13 +81,13 @@ discard block |
||
81 | 81 | } |
82 | 82 | |
83 | 83 | // if the route doesn't exist, we'll throw an exception |
84 | - if (! $routeInstance = Route::getRoutes()->getByName($route)) { |
|
84 | + if (!$routeInstance = Route::getRoutes()->getByName($route)) { |
|
85 | 85 | throw new Exception("Route [{$route}] not found while building the link for column [{$this->attributes['name']}]."); |
86 | 86 | } |
87 | 87 | |
88 | 88 | // calculate the parameters we'll be using for the route() call |
89 | 89 | // (eg. if there's only one parameter and user didn't provide it, we'll assume it's the entry's related key) |
90 | - $parameters = (function () use ($parameters, $routeInstance, $route) { |
|
90 | + $parameters = (function() use ($parameters, $routeInstance, $route) { |
|
91 | 91 | $expectedParameters = $routeInstance->parameterNames(); |
92 | 92 | |
93 | 93 | if (count($expectedParameters) === 0) { |
@@ -98,7 +98,7 @@ discard block |
||
98 | 98 | if (count($autoInferredParameter) > 1) { |
99 | 99 | throw new Exception("Route [{$route}] expects parameters [".implode(', ', $expectedParameters)."]. Insufficient parameters provided in column: [{$this->attributes['name']}]."); |
100 | 100 | } |
101 | - $autoInferredParameter = current($autoInferredParameter) ? [current($autoInferredParameter) => function ($entry, $related_key, $column, $crud) { |
|
101 | + $autoInferredParameter = current($autoInferredParameter) ? [current($autoInferredParameter) => function($entry, $related_key, $column, $crud) { |
|
102 | 102 | $entity = $crud->isAttributeInRelationString($column) ? Str::before($column['entity'], '.') : $column['entity']; |
103 | 103 | |
104 | 104 | return $related_key ?? $entry->{$entity}?->getKey(); |
@@ -108,7 +108,7 @@ discard block |
||
108 | 108 | })(); |
109 | 109 | |
110 | 110 | // set up the wrapper href attribute |
111 | - $wrapper['href'] = function ($crud, $column, $entry, $related_key) use ($route, $parameters) { |
|
111 | + $wrapper['href'] = function($crud, $column, $entry, $related_key) use ($route, $parameters) { |
|
112 | 112 | // if the parameter is callable, we'll call it |
113 | 113 | $parameters = collect($parameters)->map(fn ($item) => is_callable($item) ? $item($entry, $related_key, $column, $crud) : $item)->toArray(); |
114 | 114 | |
@@ -125,17 +125,17 @@ discard block |
||
125 | 125 | }); |
126 | 126 | } |
127 | 127 | |
128 | -if (! CrudColumn::hasMacro('linkToShow')) { |
|
129 | - CrudColumn::macro('linkToShow', function (): static { |
|
128 | +if (!CrudColumn::hasMacro('linkToShow')) { |
|
129 | + CrudColumn::macro('linkToShow', function(): static { |
|
130 | 130 | $name = $this->attributes['name']; |
131 | 131 | $entity = $this->attributes['entity'] ?? null; |
132 | 132 | $route = "$entity.show"; |
133 | 133 | |
134 | - if (! $entity) { |
|
134 | + if (!$entity) { |
|
135 | 135 | throw new Exception("Entity not found while building the link for column [{$name}]."); |
136 | 136 | } |
137 | 137 | |
138 | - if (! Route::getRoutes()->getByName($route)) { |
|
138 | + if (!Route::getRoutes()->getByName($route)) { |
|
139 | 139 | throw new Exception("Route '{$route}' not found while building the link for column [{$name}]."); |
140 | 140 | } |
141 | 141 | |
@@ -146,8 +146,8 @@ discard block |
||
146 | 146 | }); |
147 | 147 | } |
148 | 148 | |
149 | -if (! CrudColumn::hasMacro('linkTarget')) { |
|
150 | - CrudColumn::macro('linkTarget', function (string $target = '_self'): static { |
|
149 | +if (!CrudColumn::hasMacro('linkTarget')) { |
|
150 | + CrudColumn::macro('linkTarget', function(string $target = '_self'): static { |
|
151 | 151 | $this->wrapper([ |
152 | 152 | ...$this->attributes['wrapper'] ?? [], |
153 | 153 | 'target' => $target, |
@@ -163,8 +163,8 @@ discard block |
||
163 | 163 | * |
164 | 164 | * It will go to the given CrudController and get the setupRoutes() method on it. |
165 | 165 | */ |
166 | -if (! Route::hasMacro('crud')) { |
|
167 | - Route::macro('crud', function ($name, $controller) { |
|
166 | +if (!Route::hasMacro('crud')) { |
|
167 | + Route::macro('crud', function($name, $controller) { |
|
168 | 168 | // put together the route name prefix, |
169 | 169 | // as passed to the Route::group() statements |
170 | 170 | $routeName = ''; |