@@ -119,7 +119,7 @@ discard block |
||
119 | 119 | */ |
120 | 120 | protected function prepareQuery(): void |
121 | 121 | { |
122 | - if (! $this->prepared) { |
|
122 | + if (!$this->prepared) { |
|
123 | 123 | $this->totalRecords = $this->totalCount(); |
124 | 124 | |
125 | 125 | if ($this->totalRecords) { |
@@ -168,14 +168,14 @@ discard block |
||
168 | 168 | $builder = clone $this->query; |
169 | 169 | |
170 | 170 | if ($this->isComplexQuery($builder)) { |
171 | - $table = $this->connection->raw('('.$builder->toSql().') count_row_table'); |
|
171 | + $table = $this->connection->raw('(' . $builder->toSql() . ') count_row_table'); |
|
172 | 172 | |
173 | 173 | return $this->connection->table($table)->setBindings($builder->getBindings()); |
174 | 174 | } |
175 | 175 | |
176 | 176 | $row_count = $this->wrap('row_count'); |
177 | 177 | $builder->select($this->connection->raw("'1' as {$row_count}")); |
178 | - if (! $this->keepSelectBindings) { |
|
178 | + if (!$this->keepSelectBindings) { |
|
179 | 179 | $builder->setBindings([], 'select'); |
180 | 180 | } |
181 | 181 | |
@@ -251,7 +251,7 @@ discard block |
||
251 | 251 | foreach ($columns as $index => $column) { |
252 | 252 | $column = $this->getColumnName($index); |
253 | 253 | |
254 | - if (! $this->request->isColumnSearchable($index) || $this->isBlacklisted($column) && ! $this->hasFilterColumn($column)) { |
|
254 | + if (!$this->request->isColumnSearchable($index) || $this->isBlacklisted($column) && !$this->hasFilterColumn($column)) { |
|
255 | 255 | continue; |
256 | 256 | } |
257 | 257 | |
@@ -331,7 +331,7 @@ discard block |
||
331 | 331 | */ |
332 | 332 | protected function getBaseQueryBuilder($instance = null) |
333 | 333 | { |
334 | - if (! $instance) { |
|
334 | + if (!$instance) { |
|
335 | 335 | $instance = $this->query; |
336 | 336 | } |
337 | 337 | |
@@ -383,20 +383,20 @@ discard block |
||
383 | 383 | |
384 | 384 | switch ($this->connection->getDriverName()) { |
385 | 385 | case 'oracle': |
386 | - $sql = ! $this->config->isCaseInsensitive() |
|
387 | - ? 'REGEXP_LIKE( '.$column.' , ? )' |
|
388 | - : 'REGEXP_LIKE( LOWER('.$column.') , ?, \'i\' )'; |
|
386 | + $sql = !$this->config->isCaseInsensitive() |
|
387 | + ? 'REGEXP_LIKE( ' . $column . ' , ? )' |
|
388 | + : 'REGEXP_LIKE( LOWER(' . $column . ') , ?, \'i\' )'; |
|
389 | 389 | break; |
390 | 390 | |
391 | 391 | case 'pgsql': |
392 | 392 | $column = $this->castColumn($column); |
393 | - $sql = ! $this->config->isCaseInsensitive() ? $column.' ~ ?' : $column.' ~* ? '; |
|
393 | + $sql = !$this->config->isCaseInsensitive() ? $column . ' ~ ?' : $column . ' ~* ? '; |
|
394 | 394 | break; |
395 | 395 | |
396 | 396 | default: |
397 | - $sql = ! $this->config->isCaseInsensitive() |
|
398 | - ? $column.' REGEXP ?' |
|
399 | - : 'LOWER('.$column.') REGEXP ?'; |
|
397 | + $sql = !$this->config->isCaseInsensitive() |
|
398 | + ? $column . ' REGEXP ?' |
|
399 | + : 'LOWER(' . $column . ') REGEXP ?'; |
|
400 | 400 | $keyword = Str::lower($keyword); |
401 | 401 | } |
402 | 402 | |
@@ -413,9 +413,9 @@ discard block |
||
413 | 413 | { |
414 | 414 | switch ($this->connection->getDriverName()) { |
415 | 415 | case 'pgsql': |
416 | - return 'CAST('.$column.' as TEXT)'; |
|
416 | + return 'CAST(' . $column . ' as TEXT)'; |
|
417 | 417 | case 'firebird': |
418 | - return 'CAST('.$column.' as VARCHAR(255))'; |
|
418 | + return 'CAST(' . $column . ' as VARCHAR(255))'; |
|
419 | 419 | default: |
420 | 420 | return $column; |
421 | 421 | } |
@@ -434,13 +434,13 @@ discard block |
||
434 | 434 | { |
435 | 435 | $column = $this->addTablePrefix($query, $column); |
436 | 436 | $column = $this->castColumn($column); |
437 | - $sql = $column.' LIKE ?'; |
|
437 | + $sql = $column . ' LIKE ?'; |
|
438 | 438 | |
439 | 439 | if ($this->config->isCaseInsensitive()) { |
440 | - $sql = 'LOWER('.$column.') LIKE ?'; |
|
440 | + $sql = 'LOWER(' . $column . ') LIKE ?'; |
|
441 | 441 | } |
442 | 442 | |
443 | - $query->{$boolean.'WhereRaw'}($sql, [$this->prepareKeyword($keyword)]); |
|
443 | + $query->{$boolean . 'WhereRaw'}($sql, [$this->prepareKeyword($keyword)]); |
|
444 | 444 | } |
445 | 445 | |
446 | 446 | /** |
@@ -453,11 +453,11 @@ discard block |
||
453 | 453 | */ |
454 | 454 | protected function addTablePrefix($query, string $column): string |
455 | 455 | { |
456 | - if (! str_contains($column, '.')) { |
|
456 | + if (!str_contains($column, '.')) { |
|
457 | 457 | $q = $this->getBaseQueryBuilder($query); |
458 | 458 | /** @phpstan-ignore-next-line */ |
459 | - if (! $q->from instanceof Expression) { |
|
460 | - $column = $q->from.'.'.$column; |
|
459 | + if (!$q->from instanceof Expression) { |
|
460 | + $column = $q->from . '.' . $column; |
|
461 | 461 | } |
462 | 462 | } |
463 | 463 | |
@@ -670,7 +670,7 @@ discard block |
||
670 | 670 | return $orderable; |
671 | 671 | }) |
672 | 672 | ->reject(function ($orderable) { |
673 | - return $this->isBlacklisted($orderable['name']) && ! $this->hasOrderColumn($orderable['name']); |
|
673 | + return $this->isBlacklisted($orderable['name']) && !$this->hasOrderColumn($orderable['name']); |
|
674 | 674 | }) |
675 | 675 | ->each(function ($orderable) { |
676 | 676 | $column = $this->resolveRelationColumn($orderable['name']); |
@@ -679,7 +679,7 @@ discard block |
||
679 | 679 | $this->applyOrderColumn($column, $orderable); |
680 | 680 | } else { |
681 | 681 | $nullsLastSql = $this->getNullsLastSql($column, $orderable['direction']); |
682 | - $normalSql = $this->wrap($column).' '.$orderable['direction']; |
|
682 | + $normalSql = $this->wrap($column) . ' ' . $orderable['direction']; |
|
683 | 683 | $sql = $this->nullsLast ? $nullsLastSql : $normalSql; |
684 | 684 | $this->query->orderByRaw($sql); |
685 | 685 | } |
@@ -755,7 +755,7 @@ discard block |
||
755 | 755 | return $this->getColumnName($index); |
756 | 756 | }) |
757 | 757 | ->reject(function ($column) { |
758 | - return $this->isBlacklisted($column) && ! $this->hasFilterColumn($column); |
|
758 | + return $this->isBlacklisted($column) && !$this->hasFilterColumn($column); |
|
759 | 759 | }) |
760 | 760 | ->each(function ($column) use ($keyword, $query) { |
761 | 761 | if ($this->hasFilterColumn($column)) { |
@@ -22,7 +22,7 @@ discard block |
||
22 | 22 | * |
23 | 23 | * @var \Illuminate\Support\Collection|\Illuminate\Http\Resources\Json\JsonResource |
24 | 24 | */ |
25 | - public Collection|JsonResource $original; |
|
25 | + public Collection | JsonResource $original; |
|
26 | 26 | |
27 | 27 | /** |
28 | 28 | * The offset of the first record in the full dataset. |
@@ -107,7 +107,7 @@ discard block |
||
107 | 107 | for ($i = 0, $c = count($columns); $i < $c; $i++) { |
108 | 108 | $column = $this->getColumnName($i); |
109 | 109 | |
110 | - if (! $this->request->isColumnSearchable($i) || $this->isBlacklisted($column)) { |
|
110 | + if (!$this->request->isColumnSearchable($i) || $this->isBlacklisted($column)) { |
|
111 | 111 | continue; |
112 | 112 | } |
113 | 113 | |
@@ -125,14 +125,14 @@ discard block |
||
125 | 125 | |
126 | 126 | if ($this->config->isCaseInsensitive()) { |
127 | 127 | if ($regex) { |
128 | - return preg_match('/'.$keyword.'/i', $value) == 1; |
|
128 | + return preg_match('/' . $keyword . '/i', $value) == 1; |
|
129 | 129 | } |
130 | 130 | |
131 | 131 | return str_contains(Str::lower($value), Str::lower($keyword)); |
132 | 132 | } |
133 | 133 | |
134 | 134 | if ($regex) { |
135 | - return preg_match('/'.$keyword.'/', $value) == 1; |
|
135 | + return preg_match('/' . $keyword . '/', $value) == 1; |
|
136 | 136 | } |
137 | 137 | |
138 | 138 | return str_contains($value, $keyword); |
@@ -245,7 +245,7 @@ discard block |
||
245 | 245 | foreach ($this->request->searchableColumnIndex() as $index) { |
246 | 246 | $column = $this->getColumnName($index); |
247 | 247 | $value = Arr::get($data, $column); |
248 | - if (! is_string($value)) { |
|
248 | + if (!is_string($value)) { |
|
249 | 249 | continue; |
250 | 250 | } else { |
251 | 251 | $value = $this->config->isCaseInsensitive() ? Str::lower($value) : $value; |
@@ -266,7 +266,7 @@ discard block |
||
266 | 266 | protected function defaultOrdering(): void |
267 | 267 | { |
268 | 268 | $criteria = $this->request->orderableColumns(); |
269 | - if (! empty($criteria)) { |
|
269 | + if (!empty($criteria)) { |
|
270 | 270 | $sorter = $this->getSorter($criteria); |
271 | 271 | |
272 | 272 | $this->collection = $this->collection |