@@ -112,8 +112,9 @@ discard block |
||
112 | 112 | return $column->toArray(); |
113 | 113 | }, $this->columns()); |
114 | 114 | |
115 | - if ($this->hasTrait(HasActions::class)) |
|
116 | - $columns[] = $this->getActionsColumnMeta(); |
|
115 | + if ($this->hasTrait(HasActions::class)) { |
|
116 | + $columns[] = $this->getActionsColumnMeta(); |
|
117 | + } |
|
117 | 118 | |
118 | 119 | return $columns; |
119 | 120 | } |
@@ -153,8 +154,9 @@ discard block |
||
153 | 154 | |
154 | 155 | $results = array_map(function (array $sortedColumn) use ($columns): ?Column { |
155 | 156 | foreach ($columns as $column) { |
156 | - if ($sortedColumn['key'] === $column->key()) |
|
157 | - return $column->sortDirection($sortedColumn['direction']); |
|
157 | + if ($sortedColumn['key'] === $column->key()) { |
|
158 | + return $column->sortDirection($sortedColumn['direction']); |
|
159 | + } |
|
158 | 160 | } |
159 | 161 | |
160 | 162 | return null; |
@@ -54,8 +54,9 @@ |
||
54 | 54 | { |
55 | 55 | $filtered = $this->filtersQuery($request); |
56 | 56 | |
57 | - if (empty($filtered)) |
|
58 | - return $resources; |
|
57 | + if (empty($filtered)) { |
|
58 | + return $resources; |
|
59 | + } |
|
59 | 60 | |
60 | 61 | foreach ($this->filters($request) as $filter) { |
61 | 62 | if (isset($filtered[$filter->getName()])) { |
@@ -243,14 +243,17 @@ discard block |
||
243 | 243 | */ |
244 | 244 | public function sortable(?string $direction = null, Closure $callback = null): self |
245 | 245 | { |
246 | - if ( ! $this->isSortable()) |
|
247 | - $this->sortable = true; |
|
246 | + if ( ! $this->isSortable()) { |
|
247 | + $this->sortable = true; |
|
248 | + } |
|
248 | 249 | |
249 | - if ($direction) |
|
250 | - $this->sortDirection($direction); |
|
250 | + if ($direction) { |
|
251 | + $this->sortDirection($direction); |
|
252 | + } |
|
251 | 253 | |
252 | - if ($callback) |
|
253 | - $this->sortQuery($callback); |
|
254 | + if ($callback) { |
|
255 | + $this->sortQuery($callback); |
|
256 | + } |
|
254 | 257 | |
255 | 258 | return $this; |
256 | 259 | } |
@@ -323,8 +326,9 @@ discard block |
||
323 | 326 | */ |
324 | 327 | public function hasSortByDirection(): bool |
325 | 328 | { |
326 | - if (is_null($this->direction)) |
|
327 | - return false; |
|
329 | + if (is_null($this->direction)) { |
|
330 | + return false; |
|
331 | + } |
|
328 | 332 | |
329 | 333 | return in_array(strtolower($this->direction), [static::SORT_ASC, static::SORT_DESC]); |
330 | 334 | } |
@@ -154,8 +154,9 @@ |
||
154 | 154 | */ |
155 | 155 | public function apply($resources, $value) |
156 | 156 | { |
157 | - if ($this->getValue() === $value) |
|
158 | - return $resources; |
|
157 | + if ($this->getValue() === $value) { |
|
158 | + return $resources; |
|
159 | + } |
|
159 | 160 | |
160 | 161 | return ($this->query)($resources, $value); |
161 | 162 | } |
@@ -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; |
@@ -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; |
@@ -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 | } |
@@ -125,11 +125,13 @@ discard block |
||
125 | 125 | { |
126 | 126 | $query = app()->call([$this, 'handle'], compact('request')); |
127 | 127 | |
128 | - if ($query instanceof Builder) |
|
129 | - return $this->handleQuery($query, $request); |
|
128 | + if ($query instanceof Builder) { |
|
129 | + return $this->handleQuery($query, $request); |
|
130 | + } |
|
130 | 131 | |
131 | - if ($query instanceof Collection) |
|
132 | - return $this->handleCollection($query, $request); |
|
132 | + if ($query instanceof Collection) { |
|
133 | + return $this->handleCollection($query, $request); |
|
134 | + } |
|
133 | 135 | } |
134 | 136 | |
135 | 137 | /** |
@@ -144,11 +146,13 @@ discard block |
||
144 | 146 | { |
145 | 147 | $this->applySortByQuery($request, $query); |
146 | 148 | |
147 | - if ($this->hasTrait(HasFilters::class)) |
|
148 | - $query = $this->callMethod('applyFilters', [$request, $query]); |
|
149 | + if ($this->hasTrait(HasFilters::class)) { |
|
150 | + $query = $this->callMethod('applyFilters', [$request, $query]); |
|
151 | + } |
|
149 | 152 | |
150 | - if ($this->hasTrait(HasPagination::class)) |
|
151 | - return $query->paginate(call_user_func_array([$this, 'getPerPage'], [$request])); |
|
153 | + if ($this->hasTrait(HasPagination::class)) { |
|
154 | + return $query->paginate(call_user_func_array([$this, 'getPerPage'], [$request])); |
|
155 | + } |
|
152 | 156 | |
153 | 157 | return $query->get(); |
154 | 158 | } |
@@ -163,8 +167,9 @@ discard block |
||
163 | 167 | */ |
164 | 168 | protected function handleCollection(Collection $collection, Request $request) |
165 | 169 | { |
166 | - if ($this->hasTrait(HasFilters::class)) |
|
167 | - $collection = $this->callMethod('applyFilters', [$request, $collection]); |
|
170 | + if ($this->hasTrait(HasFilters::class)) { |
|
171 | + $collection = $this->callMethod('applyFilters', [$request, $collection]); |
|
172 | + } |
|
168 | 173 | |
169 | 174 | $collection = $this->applySortByCollection($request, $collection); |
170 | 175 | |
@@ -186,8 +191,9 @@ discard block |
||
186 | 191 | */ |
187 | 192 | protected function transformResults(Request $request, $items): array |
188 | 193 | { |
189 | - if ($items instanceof LengthAwarePaginator) |
|
190 | - $items = $items->getCollection(); |
|
194 | + if ($items instanceof LengthAwarePaginator) { |
|
195 | + $items = $items->getCollection(); |
|
196 | + } |
|
191 | 197 | |
192 | 198 | $transformer = $this->transformer(); |
193 | 199 |