@@ -26,16 +26,16 @@ |
||
26 | 26 | $this->prefix('dependencies')->name('dependencies.')->group(function () { |
27 | 27 | // admin::system.dependencies.index |
28 | 28 | $this->get('/', [DependenciesController::class, 'index']) |
29 | - ->name('index'); |
|
29 | + ->name('index'); |
|
30 | 30 | |
31 | 31 | // admin::system.dependencies.datatable |
32 | 32 | $this->post('datatable', [DependenciesController::class, 'datatable']) |
33 | - ->middleware(['ajax']) |
|
34 | - ->name('datatable'); |
|
33 | + ->middleware(['ajax']) |
|
34 | + ->name('datatable'); |
|
35 | 35 | |
36 | 36 | // admin::system.dependencies.show |
37 | 37 | $this->get('{admin_package_vendor}/{admin_package_name}', [DependenciesController::class, 'show']) |
38 | - ->name('show'); |
|
38 | + ->name('show'); |
|
39 | 39 | }); |
40 | 40 | } |
41 | 41 | } |
@@ -23,7 +23,7 @@ |
||
23 | 23 | */ |
24 | 24 | public function map(): void |
25 | 25 | { |
26 | - $this->prefix('dependencies')->name('dependencies.')->group(function () { |
|
26 | + $this->prefix('dependencies')->name('dependencies.')->group(function() { |
|
27 | 27 | // admin::system.dependencies.index |
28 | 28 | $this->get('/', [DependenciesController::class, 'index']) |
29 | 29 | ->name('index'); |
@@ -26,15 +26,15 @@ |
||
26 | 26 | $this->prefix('abilities')->name('abilities.')->group(function () { |
27 | 27 | // admin::system.abilities.index |
28 | 28 | $this->get('/', [AbilitiesController::class, 'index']) |
29 | - ->name('index'); |
|
29 | + ->name('index'); |
|
30 | 30 | |
31 | 31 | // admin::system.abilities.datatable |
32 | 32 | $this->post('datatable', [AbilitiesController::class, 'datatable']) |
33 | - ->name('datatable'); |
|
33 | + ->name('datatable'); |
|
34 | 34 | |
35 | 35 | // admin::system.abilities.show |
36 | 36 | $this->get('{admin_ability_key}', [AbilitiesController::class, 'show']) |
37 | - ->name('show'); |
|
37 | + ->name('show'); |
|
38 | 38 | }); |
39 | 39 | } |
40 | 40 | } |
@@ -23,7 +23,7 @@ |
||
23 | 23 | */ |
24 | 24 | public function map(): void |
25 | 25 | { |
26 | - $this->prefix('abilities')->name('abilities.')->group(function () { |
|
26 | + $this->prefix('abilities')->name('abilities.')->group(function() { |
|
27 | 27 | // admin::system.abilities.index |
28 | 28 | $this->get('/', [AbilitiesController::class, 'index']) |
29 | 29 | ->name('index'); |
@@ -73,7 +73,7 @@ |
||
73 | 73 | |
74 | 74 | $name = "{$vendorName}/{$packageName}"; |
75 | 75 | |
76 | - $package = $manifest->installed()->first(function ($installed) use ($name) { |
|
76 | + $package = $manifest->installed()->first(function($installed) use ($name) { |
|
77 | 77 | return $installed['name'] === $name; |
78 | 78 | }); |
79 | 79 |
@@ -31,7 +31,7 @@ |
||
31 | 31 | 'key' => $resource->key(), |
32 | 32 | 'name' => $resource->meta('name', ''), |
33 | 33 | 'description' => $resource->meta('description', ''), |
34 | - 'registered' => with($resource->meta('is_registered', false), function ($isRegistered) { |
|
34 | + 'registered' => with($resource->meta('is_registered', false), function($isRegistered) { |
|
35 | 35 | return [ |
36 | 36 | 'type' => $isRegistered ? 'success' : 'secondary', |
37 | 37 | 'label' => __($isRegistered ? 'Yes' : 'No'), |
@@ -30,7 +30,7 @@ discard block |
||
30 | 30 | public function transform($resource, Request $request): array |
31 | 31 | { |
32 | 32 | return [ |
33 | - 'methods' => array_map(function (array $method) { |
|
33 | + 'methods' => array_map(function(array $method) { |
|
34 | 34 | return [ |
35 | 35 | 'color' => $method['color'], |
36 | 36 | 'label' => $method['name'], |
@@ -51,7 +51,7 @@ discard block |
||
51 | 51 | 'description' => $resource->action, |
52 | 52 | ], |
53 | 53 | ], |
54 | - 'middleware' => array_map(function (string $middleware) { |
|
54 | + 'middleware' => array_map(function(string $middleware) { |
|
55 | 55 | return [ |
56 | 56 | 'color' => 'dark', |
57 | 57 | 'label' => $middleware, |
@@ -63,7 +63,7 @@ discard block |
||
63 | 63 | if (empty($search)) |
64 | 64 | return $dependencies; |
65 | 65 | |
66 | - return $dependencies->filter(function ($package) use ($search) { |
|
66 | + return $dependencies->filter(function($package) use ($search) { |
|
67 | 67 | $needles = explode(' ', Str::lower($search)); |
68 | 68 | $haystacks = [ |
69 | 69 | $package['name'], |
@@ -105,9 +105,9 @@ discard block |
||
105 | 105 | $name = $package['name']; |
106 | 106 | |
107 | 107 | return [ |
108 | - Action::link('show', 'Show', function () use ($name) { |
|
108 | + Action::link('show', 'Show', function() use ($name) { |
|
109 | 109 | return route('admin::system.dependencies.show', explode('/', $name)); |
110 | - })->can(function () use ($name) { |
|
110 | + })->can(function() use ($name) { |
|
111 | 111 | return DependenciesPolicy::can('show', [$name]); |
112 | 112 | })->asIcon() |
113 | 113 | ]; |
@@ -60,8 +60,9 @@ discard block |
||
60 | 60 | { |
61 | 61 | $search = $this->searchQuery($request); |
62 | 62 | |
63 | - if (empty($search)) |
|
64 | - return $dependencies; |
|
63 | + if (empty($search)) { |
|
64 | + return $dependencies; |
|
65 | + } |
|
65 | 66 | |
66 | 67 | return $dependencies->filter(function ($package) use ($search) { |
67 | 68 | $needles = explode(' ', Str::lower($search)); |
@@ -70,8 +71,9 @@ discard block |
||
70 | 71 | ]; |
71 | 72 | |
72 | 73 | foreach ($haystacks as $haystack) { |
73 | - if (Str::contains(Str::lower($haystack), $needles)) |
|
74 | - return true; |
|
74 | + if (Str::contains(Str::lower($haystack), $needles)) { |
|
75 | + return true; |
|
76 | + } |
|
75 | 77 | } |
76 | 78 | |
77 | 79 | return false; |
@@ -53,7 +53,7 @@ discard block |
||
53 | 53 | public function handle(PolicyManager $manager, Gate $gate, Request $request) |
54 | 54 | { |
55 | 55 | $abilities = $manager->abilities() |
56 | - ->map(function (Ability $ability) use ($gate) { |
|
56 | + ->map(function(Ability $ability) use ($gate) { |
|
57 | 57 | return $ability->setMeta('is_registered', $gate->has($ability->key())); |
58 | 58 | }) |
59 | 59 | ->values(); |
@@ -78,7 +78,7 @@ discard block |
||
78 | 78 | if (empty($search)) |
79 | 79 | return $abilities; |
80 | 80 | |
81 | - return $abilities->filter(function (Ability $ability) use ($search) { |
|
81 | + return $abilities->filter(function(Ability $ability) use ($search) { |
|
82 | 82 | $needles = explode(' ', Str::lower($search)); |
83 | 83 | |
84 | 84 | $haystacks = [ |
@@ -103,16 +103,16 @@ discard block |
||
103 | 103 | protected function columns(): array |
104 | 104 | { |
105 | 105 | return [ |
106 | - Column::make('key', 'Ability')->sortable(Column::SORT_ASC, static::sortAbilityQuery(function (Ability $ability) { |
|
106 | + Column::make('key', 'Ability')->sortable(Column::SORT_ASC, static::sortAbilityQuery(function(Ability $ability) { |
|
107 | 107 | return $ability->key(); |
108 | 108 | })), |
109 | - Column::make('name', 'Name')->sortable(null, static::sortAbilityQuery(function (Ability $ability) { |
|
109 | + Column::make('name', 'Name')->sortable(null, static::sortAbilityQuery(function(Ability $ability) { |
|
110 | 110 | return $ability->meta('name', ''); |
111 | 111 | })), |
112 | - Column::make('description', 'Description')->sortable(null, static::sortAbilityQuery(function (Ability $ability) { |
|
112 | + Column::make('description', 'Description')->sortable(null, static::sortAbilityQuery(function(Ability $ability) { |
|
113 | 113 | return $ability->meta('description', ''); |
114 | 114 | })), |
115 | - Column::make('registered', 'Registered', Column::DATATYPE_STATUS)->align('center')->sortable(null, static::sortAbilityQuery(function (Ability $ability) { |
|
115 | + Column::make('registered', 'Registered', Column::DATATYPE_STATUS)->align('center')->sortable(null, static::sortAbilityQuery(function(Ability $ability) { |
|
116 | 116 | return $ability->meta('is_registered', false); |
117 | 117 | })), |
118 | 118 | ]; |
@@ -127,7 +127,7 @@ discard block |
||
127 | 127 | */ |
128 | 128 | protected static function sortAbilityQuery(Closure $callback): Closure |
129 | 129 | { |
130 | - return function (Collection $collection, Column $column) use ($callback): Collection { |
|
130 | + return function(Collection $collection, Column $column) use ($callback): Collection { |
|
131 | 131 | return $collection->sortBy( |
132 | 132 | $callback, SORT_REGULAR, $column->getSortDirection() === Column::SORT_DESC |
133 | 133 | )->values(); |
@@ -146,8 +146,8 @@ discard block |
||
146 | 146 | 'all' => 'All', |
147 | 147 | 'registered' => 'Registered', |
148 | 148 | 'not-registered' => 'Not Registered', |
149 | - ])->query(function (Collection $abilities, string $value) { |
|
150 | - return $abilities->filter(function (Ability $ability) use ($value) { |
|
149 | + ])->query(function(Collection $abilities, string $value) { |
|
150 | + return $abilities->filter(function(Ability $ability) use ($value) { |
|
151 | 151 | return $ability->meta('is_registered', false) === ($value === 'registered'); |
152 | 152 | }); |
153 | 153 | }), |
@@ -165,9 +165,9 @@ discard block |
||
165 | 165 | protected function actions(Request $request, $ability): array |
166 | 166 | { |
167 | 167 | return [ |
168 | - Action::link('show', 'Show', function () use ($ability) { |
|
168 | + Action::link('show', 'Show', function() use ($ability) { |
|
169 | 169 | return route('admin::system.abilities.show', [$ability->key()]); |
170 | - })->can(function () use ($ability) { |
|
170 | + })->can(function() use ($ability) { |
|
171 | 171 | return AbilitiesPolicy::can('show', [$ability]); |
172 | 172 | })->asIcon() |
173 | 173 | ]; |
@@ -75,8 +75,9 @@ discard block |
||
75 | 75 | { |
76 | 76 | $search = $this->searchQuery($request); |
77 | 77 | |
78 | - if (empty($search)) |
|
79 | - return $abilities; |
|
78 | + if (empty($search)) { |
|
79 | + return $abilities; |
|
80 | + } |
|
80 | 81 | |
81 | 82 | return $abilities->filter(function (Ability $ability) use ($search) { |
82 | 83 | $needles = explode(' ', Str::lower($search)); |
@@ -88,8 +89,9 @@ discard block |
||
88 | 89 | ]; |
89 | 90 | |
90 | 91 | foreach ($haystacks as $haystack) { |
91 | - if (Str::contains(Str::lower($haystack), $needles)) |
|
92 | - return true; |
|
92 | + if (Str::contains(Str::lower($haystack), $needles)) { |
|
93 | + return true; |
|
94 | + } |
|
93 | 95 | } |
94 | 96 | |
95 | 97 | return false; |
@@ -63,7 +63,7 @@ discard block |
||
63 | 63 | if (empty($search)) |
64 | 64 | return $routes; |
65 | 65 | |
66 | - return $routes->filter(function (Route $route) use ($search): bool { |
|
66 | + return $routes->filter(function(Route $route) use ($search): bool { |
|
67 | 67 | $needles = explode(' ', Str::lower($search)); |
68 | 68 | $haystacks = [ |
69 | 69 | $route->uri, |
@@ -111,8 +111,8 @@ discard block |
||
111 | 111 | 'POST' => 'POST', |
112 | 112 | 'PUT' => 'PUT', |
113 | 113 | 'DELETE' => 'DELETE', |
114 | - ])->query(function (RouteCollection $routes, string $value) { |
|
115 | - return $routes->filter(function (Route $route) use ($value) { |
|
114 | + ])->query(function(RouteCollection $routes, string $value) { |
|
115 | + return $routes->filter(function(Route $route) use ($value) { |
|
116 | 116 | $methods = Arr::pluck($route->methods, 'name'); |
117 | 117 | |
118 | 118 | return in_array($value, $methods); |
@@ -60,8 +60,9 @@ discard block |
||
60 | 60 | { |
61 | 61 | $search = $this->searchQuery($request); |
62 | 62 | |
63 | - if (empty($search)) |
|
64 | - return $routes; |
|
63 | + if (empty($search)) { |
|
64 | + return $routes; |
|
65 | + } |
|
65 | 66 | |
66 | 67 | return $routes->filter(function (Route $route) use ($search): bool { |
67 | 68 | $needles = explode(' ', Str::lower($search)); |
@@ -72,8 +73,9 @@ discard block |
||
72 | 73 | ]; |
73 | 74 | |
74 | 75 | foreach ($haystacks as $haystack) { |
75 | - if (Str::contains(Str::lower($haystack), $needles)) |
|
76 | - return true; |
|
76 | + if (Str::contains(Str::lower($haystack), $needles)) { |
|
77 | + return true; |
|
78 | + } |
|
77 | 79 | } |
78 | 80 | |
79 | 81 | return false; |
@@ -75,8 +75,9 @@ discard block |
||
75 | 75 | */ |
76 | 76 | public function data(): array |
77 | 77 | { |
78 | - if ($this->isDisabled()) |
|
79 | - return []; |
|
78 | + if ($this->isDisabled()) { |
|
79 | + return []; |
|
80 | + } |
|
80 | 81 | |
81 | 82 | return json_decode(file_get_contents($this->getDownPath()), true); |
82 | 83 | } |
@@ -127,8 +128,9 @@ discard block |
||
127 | 128 | */ |
128 | 129 | protected function renderTemplate(?string $template): ?string |
129 | 130 | { |
130 | - if (is_null($template)) |
|
131 | - return null; |
|
131 | + if (is_null($template)) { |
|
132 | + return null; |
|
133 | + } |
|
132 | 134 | |
133 | 135 | (new RegisterErrorViewPaths)(); |
134 | 136 | |
@@ -189,8 +191,9 @@ discard block |
||
189 | 191 | */ |
190 | 192 | protected function getRetryTime($retry) |
191 | 193 | { |
192 | - if (is_numeric($retry) && $retry > 0) |
|
193 | - return (int) $retry; |
|
194 | + if (is_numeric($retry) && $retry > 0) { |
|
195 | + return (int) $retry; |
|
196 | + } |
|
194 | 197 | |
195 | 198 | return null; |
196 | 199 | } |
@@ -204,8 +207,9 @@ discard block |
||
204 | 207 | */ |
205 | 208 | protected function redirectPath(?string $redirect) |
206 | 209 | { |
207 | - if ($redirect && $redirect !== '/') |
|
208 | - return '/'.trim($redirect, '/'); |
|
210 | + if ($redirect && $redirect !== '/') { |
|
211 | + return '/'.trim($redirect, '/'); |
|
212 | + } |
|
209 | 213 | |
210 | 214 | return $redirect; |
211 | 215 | } |