We could not synchronize checks via GitHub's checks API since Scrutinizer's GitHub App is not installed for this repository.
@@ -23,7 +23,7 @@ |
||
| 23 | 23 | (array) config('backpack.base.middleware_key', 'admin'), |
| 24 | 24 | 'prefix' => config('backpack.base.route_prefix', 'admin'), |
| 25 | 25 | ], |
| 26 | - function () { |
|
| 26 | + function() { |
|
| 27 | 27 | Route::get('articles/{id}/show/{detail}', ['as' => 'article.show.detail', 'action' => 'Backpack\CRUD\Tests\config\Http\Controllers\ArticleCrudController@detail']); |
| 28 | 28 | Route::crud('users', 'Backpack\CRUD\Tests\config\Http\Controllers\UserCrudController'); |
| 29 | 29 | Route::crud('articles', 'Backpack\CRUD\Tests\config\Http\Controllers\ArticleCrudController'); |
@@ -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 | $uploadDefinition = is_array($uploadDefinition) ? $uploadDefinition : []; |
| 40 | 40 | /** @var CrudField|CrudColumn $this */ |
| 41 | 41 | RegisterUploadEvents::handle($this, $uploadDefinition, 'withFiles', $subfield, $registerUploaderEvents); |
@@ -44,8 +44,8 @@ discard block |
||
| 44 | 44 | }); |
| 45 | 45 | } |
| 46 | 46 | |
| 47 | -if (! CrudField::hasMacro('withFiles')) { |
|
| 48 | - CrudField::macro('withFiles', function ($uploadDefinition = [], $subfield = null, $registerUploaderEvents = true) { |
|
| 47 | +if (!CrudField::hasMacro('withFiles')) { |
|
| 48 | + CrudField::macro('withFiles', function($uploadDefinition = [], $subfield = null, $registerUploaderEvents = true) { |
|
| 49 | 49 | $uploadDefinition = is_array($uploadDefinition) ? $uploadDefinition : []; |
| 50 | 50 | /** @var CrudField|CrudColumn $this */ |
| 51 | 51 | RegisterUploadEvents::handle($this, $uploadDefinition, 'withFiles', $subfield, $registerUploaderEvents); |
@@ -54,8 +54,8 @@ discard block |
||
| 54 | 54 | }); |
| 55 | 55 | } |
| 56 | 56 | |
| 57 | -if (! CrudColumn::hasMacro('linkTo')) { |
|
| 58 | - CrudColumn::macro('linkTo', function (string|array|Closure $routeOrConfiguration, ?array $parameters = []): static { |
|
| 57 | +if (!CrudColumn::hasMacro('linkTo')) { |
|
| 58 | + CrudColumn::macro('linkTo', function(string | array | Closure $routeOrConfiguration, ?array $parameters = []): static { |
|
| 59 | 59 | $wrapper = $this->attributes['wrapper'] ?? []; |
| 60 | 60 | if (is_array($routeOrConfiguration)) { |
| 61 | 61 | $route = $routeOrConfiguration['route'] ?? null; |
@@ -64,8 +64,8 @@ discard block |
||
| 64 | 64 | $route = $routeOrConfiguration; |
| 65 | 65 | } |
| 66 | 66 | |
| 67 | - if($route instanceof Closure) { |
|
| 68 | - $wrapper['href'] = function ($crud, $column, $entry, $related_key) use ($route) { |
|
| 67 | + if ($route instanceof Closure) { |
|
| 68 | + $wrapper['href'] = function($crud, $column, $entry, $related_key) use ($route) { |
|
| 69 | 69 | return $route($entry, $related_key, $column, $crud); |
| 70 | 70 | }; |
| 71 | 71 | $this->wrapper($wrapper); |
@@ -74,18 +74,18 @@ discard block |
||
| 74 | 74 | |
| 75 | 75 | $routeInstance = Route::getRoutes()->getByName($route); |
| 76 | 76 | |
| 77 | - if (! $routeInstance) { |
|
| 77 | + if (!$routeInstance) { |
|
| 78 | 78 | throw new \Exception("Route [{$route}] not found while building the link for column [{$this->attributes['name']}]."); |
| 79 | 79 | } |
| 80 | 80 | |
| 81 | 81 | $expectedParameters = $routeInstance->parameterNames(); |
| 82 | 82 | |
| 83 | 83 | $parameters = (function() use ($parameters, $expectedParameters, $route) { |
| 84 | - if(count($expectedParameters) === 0) { |
|
| 84 | + if (count($expectedParameters) === 0) { |
|
| 85 | 85 | return $parameters; |
| 86 | 86 | } |
| 87 | 87 | $autoInferedParameter = array_diff($expectedParameters, array_keys($parameters)); |
| 88 | - if(count($autoInferedParameter) > 1) { |
|
| 88 | + if (count($autoInferedParameter) > 1) { |
|
| 89 | 89 | throw new \Exception("Route [{$route}] expects parameters [".implode(', ', $expectedParameters)."]. Insuficient parameters provided in column: [{$this->attributes['name']}]."); |
| 90 | 90 | } |
| 91 | 91 | $autoInferedParameter = current($autoInferedParameter) ? [current($autoInferedParameter) => function($entry, $related_key, $column, $crud) { |
@@ -95,7 +95,7 @@ discard block |
||
| 95 | 95 | return array_merge($autoInferedParameter, $parameters); |
| 96 | 96 | })(); |
| 97 | 97 | |
| 98 | - $wrapper['href'] = function ($crud, $column, $entry, $related_key) use ($route, $parameters) { |
|
| 98 | + $wrapper['href'] = function($crud, $column, $entry, $related_key) use ($route, $parameters) { |
|
| 99 | 99 | $parameters = collect($parameters)->map(fn($item) => is_callable($item) ? $item($entry, $related_key, $column, $crud) : $item)->toArray(); |
| 100 | 100 | return route($route, $parameters); |
| 101 | 101 | }; |
@@ -111,8 +111,8 @@ discard block |
||
| 111 | 111 | * |
| 112 | 112 | * It will go to the given CrudController and get the setupRoutes() method on it. |
| 113 | 113 | */ |
| 114 | -if (! Route::hasMacro('crud')) { |
|
| 115 | - Route::macro('crud', function ($name, $controller) { |
|
| 114 | +if (!Route::hasMacro('crud')) { |
|
| 115 | + Route::macro('crud', function($name, $controller) { |
|
| 116 | 116 | // put together the route name prefix, |
| 117 | 117 | // as passed to the Route::group() statements |
| 118 | 118 | $routeName = ''; |
@@ -44,7 +44,7 @@ |
||
| 44 | 44 | ->filter(fn ($item) => isset($item[$macro])); |
| 45 | 45 | |
| 46 | 46 | $subfieldsWithMacros->each( |
| 47 | - function ($item) use ($subfieldsWithMacros, $macro) { |
|
| 47 | + function($item) use ($subfieldsWithMacros, $macro) { |
|
| 48 | 48 | if ($subfieldsWithMacros->last() === $item) { |
| 49 | 49 | $this->{$macro}($item[$macro], $item); |
| 50 | 50 | } else { |