@@ -41,8 +41,8 @@ |
||
41 | 41 | */ |
42 | 42 | public function rowValue($attribute, $template) |
43 | 43 | { |
44 | - if (! empty($template)) { |
|
45 | - if (! is_callable($template) && Arr::get($this->data, $template)) { |
|
44 | + if (!empty($template)) { |
|
45 | + if (!is_callable($template) && Arr::get($this->data, $template)) { |
|
46 | 46 | $this->data[$attribute] = Arr::get($this->data, $template); |
47 | 47 | } else { |
48 | 48 | $this->data[$attribute] = Helper::compileContent($template, $this->data, $this->row); |
@@ -1,6 +1,6 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | |
3 | -if (! function_exists('config_path')) { |
|
3 | +if (!function_exists('config_path')) { |
|
4 | 4 | /** |
5 | 5 | * Get the configuration path. |
6 | 6 | * |
@@ -13,7 +13,7 @@ discard block |
||
13 | 13 | } |
14 | 14 | } |
15 | 15 | |
16 | -if (! function_exists('public_path')) { |
|
16 | +if (!function_exists('public_path')) { |
|
17 | 17 | /** |
18 | 18 | * Return the path to public dir. |
19 | 19 | * |
@@ -1,6 +1,6 @@ |
||
1 | 1 | <?php |
2 | 2 | |
3 | -if (! function_exists('datatables')) { |
|
3 | +if (!function_exists('datatables')) { |
|
4 | 4 | /** |
5 | 5 | * Helper to make a new DataTable instance from source. |
6 | 6 | * Or return the factory if source is not set. |
@@ -90,7 +90,7 @@ discard block |
||
90 | 90 | */ |
91 | 91 | public function orderableColumns() |
92 | 92 | { |
93 | - if (! $this->isOrderable()) { |
|
93 | + if (!$this->isOrderable()) { |
|
94 | 94 | return []; |
95 | 95 | } |
96 | 96 | |
@@ -220,8 +220,8 @@ discard block |
||
220 | 220 | */ |
221 | 221 | public function isPaginationable() |
222 | 222 | { |
223 | - return ! is_null($this->request->input('start')) && |
|
224 | - ! is_null($this->request->input('length')) && |
|
223 | + return !is_null($this->request->input('start')) && |
|
224 | + !is_null($this->request->input('length')) && |
|
225 | 225 | $this->request->input('length') != -1; |
226 | 226 | } |
227 | 227 | } |
@@ -134,7 +134,7 @@ |
||
134 | 134 | */ |
135 | 135 | public function getHtmlBuilder() |
136 | 136 | { |
137 | - if (! class_exists('\Yajra\DataTables\Html\Builder')) { |
|
137 | + if (!class_exists('\Yajra\DataTables\Html\Builder')) { |
|
138 | 138 | throw new \Exception('Please install yajra/laravel-datatables-html to be able to use this function.'); |
139 | 139 | } |
140 | 140 |
@@ -129,7 +129,6 @@ |
||
129 | 129 | /** |
130 | 130 | * DataTables using Collection. |
131 | 131 | * |
132 | - * @param \Illuminate\Http\Resources\Json\AnonymousResourceCollection|array $collection |
|
133 | 132 | * @return DataTableAbstract|ApiResourceDataTable |
134 | 133 | */ |
135 | 134 | public function resource($resource) |
@@ -140,7 +140,7 @@ discard block |
||
140 | 140 | */ |
141 | 141 | public static function getOrMethod($method) |
142 | 142 | { |
143 | - if (! Str::contains(Str::lower($method), 'or')) { |
|
143 | + if (!Str::contains(Str::lower($method), 'or')) { |
|
144 | 144 | return 'or' . ucfirst($method); |
145 | 145 | } |
146 | 146 | |
@@ -256,7 +256,7 @@ discard block |
||
256 | 256 | { |
257 | 257 | $matches = explode(' as ', Str::lower($str)); |
258 | 258 | |
259 | - if (! empty($matches)) { |
|
259 | + if (!empty($matches)) { |
|
260 | 260 | if ($wantsAlias) { |
261 | 261 | return array_pop($matches); |
262 | 262 | } |
@@ -474,7 +474,7 @@ discard block |
||
474 | 474 | */ |
475 | 475 | public function pushToBlacklist($column) |
476 | 476 | { |
477 | - if (! $this->isBlacklisted($column)) { |
|
477 | + if (!$this->isBlacklisted($column)) { |
|
478 | 478 | $this->columnDef['blacklist'][] = $column; |
479 | 479 | } |
480 | 480 | |
@@ -659,7 +659,7 @@ discard block |
||
659 | 659 | */ |
660 | 660 | protected function paginate() |
661 | 661 | { |
662 | - if ($this->request->isPaginationable() && ! $this->skipPaging) { |
|
662 | + if ($this->request->isPaginationable() && !$this->skipPaging) { |
|
663 | 663 | $this->paging(); |
664 | 664 | } |
665 | 665 | } |
@@ -766,7 +766,7 @@ discard block |
||
766 | 766 | $error = $this->config->get('datatables.error'); |
767 | 767 | $debug = $this->config->get('app.debug'); |
768 | 768 | |
769 | - if ($error === 'throw' || (! $error && ! $debug)) { |
|
769 | + if ($error === 'throw' || (!$error && !$debug)) { |
|
770 | 770 | throw new Exception($exception->getMessage(), $code = 0, $exception); |
771 | 771 | } |
772 | 772 | |
@@ -777,7 +777,7 @@ discard block |
||
777 | 777 | 'recordsTotal' => $this->totalRecords, |
778 | 778 | 'recordsFiltered' => 0, |
779 | 779 | 'data' => [], |
780 | - 'error' => $error ? __($error) : "Exception Message:\n\n".$exception->getMessage(), |
|
780 | + 'error' => $error ? __($error) : "Exception Message:\n\n" . $exception->getMessage(), |
|
781 | 781 | ]); |
782 | 782 | } |
783 | 783 | |
@@ -815,7 +815,7 @@ discard block |
||
815 | 815 | protected function setupKeyword($value) |
816 | 816 | { |
817 | 817 | if ($this->config->isSmartSearch()) { |
818 | - $keyword = '%'.$value.'%'; |
|
818 | + $keyword = '%' . $value . '%'; |
|
819 | 819 | if ($this->config->isWildcard()) { |
820 | 820 | $keyword = Helper::wildcardLikeString($value); |
821 | 821 | } |
@@ -100,9 +100,9 @@ discard block |
||
100 | 100 | { |
101 | 101 | $columns = $this->request->get('columns', []); |
102 | 102 | for ($i = 0, $c = count($columns); $i < $c; $i++) { |
103 | - $column = $this->getColumnName($i); |
|
103 | + $column = $this->getColumnName($i); |
|
104 | 104 | |
105 | - if (! $this->request->isColumnSearchable($i) || $this->isBlacklisted($column)) { |
|
105 | + if (!$this->request->isColumnSearchable($i) || $this->isBlacklisted($column)) { |
|
106 | 106 | continue; |
107 | 107 | } |
108 | 108 | |
@@ -232,8 +232,8 @@ discard block |
||
232 | 232 | foreach ($this->request->searchableColumnIndex() as $index) { |
233 | 233 | $column = $this->getColumnName($index); |
234 | 234 | $value = Arr::get($data, $column); |
235 | - if (! $value || is_array($value)) { |
|
236 | - if (! is_numeric($value)) { |
|
235 | + if (!$value || is_array($value)) { |
|
236 | + if (!is_numeric($value)) { |
|
237 | 237 | continue; |
238 | 238 | } |
239 | 239 | |
@@ -256,7 +256,7 @@ discard block |
||
256 | 256 | protected function defaultOrdering() |
257 | 257 | { |
258 | 258 | $criteria = $this->request->orderableColumns(); |
259 | - if (! empty($criteria)) { |
|
259 | + if (!empty($criteria)) { |
|
260 | 260 | $sorter = $this->getSorter($criteria); |
261 | 261 | |
262 | 262 | $this->collection = $this->collection |
@@ -112,7 +112,7 @@ discard block |
||
112 | 112 | */ |
113 | 113 | protected function prepareQuery() |
114 | 114 | { |
115 | - if (! $this->prepared) { |
|
115 | + if (!$this->prepared) { |
|
116 | 116 | $this->totalRecords = $this->totalCount(); |
117 | 117 | |
118 | 118 | if ($this->totalRecords) { |
@@ -203,10 +203,10 @@ discard block |
||
203 | 203 | { |
204 | 204 | $builder = clone $this->query; |
205 | 205 | |
206 | - if (! $this->isComplexQuery($builder)) { |
|
206 | + if (!$this->isComplexQuery($builder)) { |
|
207 | 207 | $row_count = $this->wrap('row_count'); |
208 | 208 | $builder->select($this->connection->raw("'1' as {$row_count}")); |
209 | - if (! $this->keepSelectBindings) { |
|
209 | + if (!$this->keepSelectBindings) { |
|
210 | 210 | $builder->setBindings([], 'select'); |
211 | 211 | } |
212 | 212 | } |
@@ -280,7 +280,7 @@ discard block |
||
280 | 280 | foreach ($columns as $index => $column) { |
281 | 281 | $column = $this->getColumnName($index); |
282 | 282 | |
283 | - if (! $this->request->isColumnSearchable($index) || $this->isBlacklisted($column) && ! $this->hasFilterColumn($column)) { |
|
283 | + if (!$this->request->isColumnSearchable($index) || $this->isBlacklisted($column) && !$this->hasFilterColumn($column)) { |
|
284 | 284 | continue; |
285 | 285 | } |
286 | 286 | |
@@ -357,7 +357,7 @@ discard block |
||
357 | 357 | */ |
358 | 358 | protected function getBaseQueryBuilder($instance = null) |
359 | 359 | { |
360 | - if (! $instance) { |
|
360 | + if (!$instance) { |
|
361 | 361 | $instance = $this->query; |
362 | 362 | } |
363 | 363 | |
@@ -406,18 +406,18 @@ discard block |
||
406 | 406 | { |
407 | 407 | switch ($this->connection->getDriverName()) { |
408 | 408 | case 'oracle': |
409 | - $sql = ! $this->config->isCaseInsensitive() |
|
409 | + $sql = !$this->config->isCaseInsensitive() |
|
410 | 410 | ? 'REGEXP_LIKE( ' . $column . ' , ? )' |
411 | 411 | : 'REGEXP_LIKE( LOWER(' . $column . ') , ?, \'i\' )'; |
412 | 412 | break; |
413 | 413 | |
414 | 414 | case 'pgsql': |
415 | 415 | $column = $this->castColumn($column); |
416 | - $sql = ! $this->config->isCaseInsensitive() ? $column . ' ~ ?' : $column . ' ~* ? '; |
|
416 | + $sql = !$this->config->isCaseInsensitive() ? $column . ' ~ ?' : $column . ' ~* ? '; |
|
417 | 417 | break; |
418 | 418 | |
419 | 419 | default: |
420 | - $sql = ! $this->config->isCaseInsensitive() |
|
420 | + $sql = !$this->config->isCaseInsensitive() |
|
421 | 421 | ? $column . ' REGEXP ?' |
422 | 422 | : 'LOWER(' . $column . ') REGEXP ?'; |
423 | 423 | $keyword = Str::lower($keyword); |
@@ -477,7 +477,7 @@ discard block |
||
477 | 477 | { |
478 | 478 | if (strpos($column, '.') === false) { |
479 | 479 | $q = $this->getBaseQueryBuilder($query); |
480 | - if (! $q->from instanceof Expression) { |
|
480 | + if (!$q->from instanceof Expression) { |
|
481 | 481 | $column = $q->from . '.' . $column; |
482 | 482 | } |
483 | 483 | } |
@@ -634,7 +634,7 @@ discard block |
||
634 | 634 | return $orderable; |
635 | 635 | }) |
636 | 636 | ->reject(function ($orderable) { |
637 | - return $this->isBlacklisted($orderable['name']) && ! $this->hasOrderColumn($orderable['name']); |
|
637 | + return $this->isBlacklisted($orderable['name']) && !$this->hasOrderColumn($orderable['name']); |
|
638 | 638 | }) |
639 | 639 | ->each(function ($orderable) { |
640 | 640 | $column = $this->resolveRelationColumn($orderable['name']); |
@@ -702,7 +702,7 @@ discard block |
||
702 | 702 | return $this->getColumnName($index); |
703 | 703 | }) |
704 | 704 | ->reject(function ($column) { |
705 | - return $this->isBlacklisted($column) && ! $this->hasFilterColumn($column); |
|
705 | + return $this->isBlacklisted($column) && !$this->hasFilterColumn($column); |
|
706 | 706 | }) |
707 | 707 | ->each(function ($column) use ($keyword, $query) { |
708 | 708 | if ($this->hasFilterColumn($column)) { |