@@ -131,7 +131,7 @@ |
||
| 131 | 131 | */ |
| 132 | 132 | public static function getOrMethod($method) |
| 133 | 133 | { |
| 134 | - if (! Str::contains(Str::lower($method), 'or')) { |
|
| 134 | + if (!Str::contains(Str::lower($method), 'or')) { |
|
| 135 | 135 | return 'or' . ucfirst($method); |
| 136 | 136 | } |
| 137 | 137 | |
@@ -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); |
@@ -17,9 +17,9 @@ discard block |
||
| 17 | 17 | */ |
| 18 | 18 | public function checkLegacyCode() |
| 19 | 19 | { |
| 20 | - if (! $this->get('draw') && $this->get('sEcho')) { |
|
| 20 | + if (!$this->get('draw') && $this->get('sEcho')) { |
|
| 21 | 21 | throw new Exception('DataTables legacy code is not supported! Please use DataTables 1.10++ coding convention.'); |
| 22 | - } elseif (! $this->get('draw') && ! $this->get('columns')) { |
|
| 22 | + } elseif (!$this->get('draw') && !$this->get('columns')) { |
|
| 23 | 23 | throw new Exception('Insufficient parameters'); |
| 24 | 24 | } |
| 25 | 25 | } |
@@ -63,7 +63,7 @@ discard block |
||
| 63 | 63 | */ |
| 64 | 64 | public function orderableColumns() |
| 65 | 65 | { |
| 66 | - if (! $this->isOrderable()) { |
|
| 66 | + if (!$this->isOrderable()) { |
|
| 67 | 67 | return []; |
| 68 | 68 | } |
| 69 | 69 | |
@@ -162,6 +162,6 @@ discard block |
||
| 162 | 162 | */ |
| 163 | 163 | public function isPaginationable() |
| 164 | 164 | { |
| 165 | - return ! is_null($this->get('start')) && ! is_null($this->get('length')) && $this->get('length') != -1; |
|
| 165 | + return !is_null($this->get('start')) && !is_null($this->get('length')) && $this->get('length') != -1; |
|
| 166 | 166 | } |
| 167 | 167 | } |
@@ -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 | * |
@@ -309,7 +309,7 @@ |
||
| 309 | 309 | * Perform case insensitive column search. |
| 310 | 310 | * |
| 311 | 311 | * @param int $i |
| 312 | - * @param mixed $column |
|
| 312 | + * @param string $column |
|
| 313 | 313 | * @param string $keyword |
| 314 | 314 | */ |
| 315 | 315 | protected function caseInsensitiveColumnSearch($i, $column, $keyword) |
@@ -96,13 +96,13 @@ discard block |
||
| 96 | 96 | $myQuery = clone $this->query; |
| 97 | 97 | // if its a normal query ( no union, having and distinct word ) |
| 98 | 98 | // replace the select with static text to improve performance |
| 99 | - if (! Str::contains(Str::lower($myQuery->toSql()), ['union', 'having', 'distinct', 'order by', 'group by'])) { |
|
| 99 | + if (!Str::contains(Str::lower($myQuery->toSql()), ['union', 'having', 'distinct', 'order by', 'group by'])) { |
|
| 100 | 100 | $row_count = $this->wrap('row_count'); |
| 101 | 101 | $myQuery->select($this->connection->raw("'1' as {$row_count}")); |
| 102 | 102 | } |
| 103 | 103 | |
| 104 | 104 | // check for select soft deleted records |
| 105 | - if (! $this->withTrashed && $this->modelUseSoftDeletes()) { |
|
| 105 | + if (!$this->withTrashed && $this->modelUseSoftDeletes()) { |
|
| 106 | 106 | $myQuery->whereNull($myQuery->getModel()->getTable() . '.deleted_at'); |
| 107 | 107 | } |
| 108 | 108 | |
@@ -158,7 +158,7 @@ discard block |
||
| 158 | 158 | $columnDef = $this->columnDef['filter'][$columnName]; |
| 159 | 159 | // check if global search should be applied for the specific column |
| 160 | 160 | $applyGlobalSearch = count($columnDef['parameters']) == 0 || end($columnDef['parameters']) !== false; |
| 161 | - if (! $applyGlobalSearch) { |
|
| 161 | + if (!$applyGlobalSearch) { |
|
| 162 | 162 | continue; |
| 163 | 163 | } |
| 164 | 164 | |
@@ -358,7 +358,7 @@ discard block |
||
| 358 | 358 | $columns = $this->request->get('columns', []); |
| 359 | 359 | |
| 360 | 360 | foreach ($columns as $index => $column) { |
| 361 | - if (! $this->request->isColumnSearchable($index)) { |
|
| 361 | + if (!$this->request->isColumnSearchable($index)) { |
|
| 362 | 362 | continue; |
| 363 | 363 | } |
| 364 | 364 | |
@@ -439,7 +439,7 @@ discard block |
||
| 439 | 439 | $pivotPK = $model->getForeignKey(); |
| 440 | 440 | $pivotFK = $model->getQualifiedParentKeyName(); |
| 441 | 441 | |
| 442 | - if (! in_array($pivot, $joins)) { |
|
| 442 | + if (!in_array($pivot, $joins)) { |
|
| 443 | 443 | $this->getQueryBuilder()->leftJoin($pivot, $pivotPK, '=', $pivotFK); |
| 444 | 444 | } |
| 445 | 445 | |
@@ -448,7 +448,7 @@ discard block |
||
| 448 | 448 | $tablePK = $related->getForeignKey(); |
| 449 | 449 | $tableFK = $related->getQualifiedKeyName(); |
| 450 | 450 | |
| 451 | - if (! in_array($table, $joins)) { |
|
| 451 | + if (!in_array($table, $joins)) { |
|
| 452 | 452 | $this->getQueryBuilder()->leftJoin($table, $pivot . '.' . $tablePK, '=', $tableFK); |
| 453 | 453 | } |
| 454 | 454 | } else { |
@@ -461,7 +461,7 @@ discard block |
||
| 461 | 461 | $other = $model->getQualifiedOtherKeyName(); |
| 462 | 462 | } |
| 463 | 463 | |
| 464 | - if (! in_array($table, $joins)) { |
|
| 464 | + if (!in_array($table, $joins)) { |
|
| 465 | 465 | $this->getQueryBuilder()->leftJoin($table, $foreign, '=', $other); |
| 466 | 466 | } |
| 467 | 467 | } |
@@ -497,10 +497,10 @@ discard block |
||
| 497 | 497 | protected function regexColumnSearch($column, $keyword) |
| 498 | 498 | { |
| 499 | 499 | if ($this->isOracleSql()) { |
| 500 | - $sql = ! $this->isCaseInsensitive() ? 'REGEXP_LIKE( ' . $column . ' , ? )' : 'REGEXP_LIKE( LOWER(' . $column . ') , ?, \'i\' )'; |
|
| 500 | + $sql = !$this->isCaseInsensitive() ? 'REGEXP_LIKE( ' . $column . ' , ? )' : 'REGEXP_LIKE( LOWER(' . $column . ') , ?, \'i\' )'; |
|
| 501 | 501 | $this->query->whereRaw($sql, [$keyword]); |
| 502 | 502 | } else { |
| 503 | - $sql = ! $this->isCaseInsensitive() ? $column . ' REGEXP ?' : 'LOWER(' . $column . ') REGEXP ?'; |
|
| 503 | + $sql = !$this->isCaseInsensitive() ? $column . ' REGEXP ?' : 'LOWER(' . $column . ') REGEXP ?'; |
|
| 504 | 504 | $this->query->whereRaw($sql, [Str::lower($keyword)]); |
| 505 | 505 | } |
| 506 | 506 | } |
@@ -545,7 +545,7 @@ discard block |
||
| 545 | 545 | |
| 546 | 546 | if (in_array($relation, $eagerLoads)) { |
| 547 | 547 | $relationship = $this->query->getRelation($relation); |
| 548 | - if (! ($relationship instanceof MorphToMany)) { |
|
| 548 | + if (!($relationship instanceof MorphToMany)) { |
|
| 549 | 549 | $column = $this->joinEagerLoadedColumn($relation, $relationColumn); |
| 550 | 550 | } else { |
| 551 | 551 | $valid = 0; |
@@ -770,7 +770,7 @@ |
||
| 770 | 770 | * Get column name by order column index. |
| 771 | 771 | * |
| 772 | 772 | * @param int $index |
| 773 | - * @return mixed |
|
| 773 | + * @return boolean|string |
|
| 774 | 774 | */ |
| 775 | 775 | protected function getColumnNameByIndex($index) |
| 776 | 776 | { |
@@ -288,7 +288,7 @@ discard block |
||
| 288 | 288 | foreach ($joins as $join) { |
| 289 | 289 | $table = preg_split('/ as /i', $join->table); |
| 290 | 290 | $names[] = $table[0]; |
| 291 | - if (isset($table[1]) && ! empty($databasePrefix) && strpos($table[1], $databasePrefix) == 0) { |
|
| 291 | + if (isset($table[1]) && !empty($databasePrefix) && strpos($table[1], $databasePrefix) == 0) { |
|
| 292 | 292 | $names[] = preg_replace('/^' . $databasePrefix . '/', '', $table[1]); |
| 293 | 293 | } |
| 294 | 294 | } |
@@ -304,7 +304,7 @@ discard block |
||
| 304 | 304 | */ |
| 305 | 305 | public function getQueryBuilder($instance = null) |
| 306 | 306 | { |
| 307 | - if (! $instance) { |
|
| 307 | + if (!$instance) { |
|
| 308 | 308 | $instance = $this->query; |
| 309 | 309 | } |
| 310 | 310 | |
@@ -588,7 +588,7 @@ discard block |
||
| 588 | 588 | $this->totalRecords = $this->totalCount(); |
| 589 | 589 | |
| 590 | 590 | if ($this->totalRecords) { |
| 591 | - $this->orderRecords(! $orderFirst); |
|
| 591 | + $this->orderRecords(!$orderFirst); |
|
| 592 | 592 | $this->filterRecords(); |
| 593 | 593 | $this->orderRecords($orderFirst); |
| 594 | 594 | $this->paginate(); |
@@ -605,7 +605,7 @@ discard block |
||
| 605 | 605 | */ |
| 606 | 606 | public function orderRecords($skip) |
| 607 | 607 | { |
| 608 | - if (! $skip) { |
|
| 608 | + if (!$skip) { |
|
| 609 | 609 | $this->ordering(); |
| 610 | 610 | } |
| 611 | 611 | } |
@@ -636,7 +636,7 @@ discard block |
||
| 636 | 636 | */ |
| 637 | 637 | public function paginate() |
| 638 | 638 | { |
| 639 | - if ($this->request->isPaginationable() && ! $this->skipPaging) { |
|
| 639 | + if ($this->request->isPaginationable() && !$this->skipPaging) { |
|
| 640 | 640 | $this->paging(); |
| 641 | 641 | } |
| 642 | 642 | } |
@@ -957,7 +957,7 @@ discard block |
||
| 957 | 957 | { |
| 958 | 958 | $matches = explode(' as ', Str::lower($str)); |
| 959 | 959 | |
| 960 | - if (! empty($matches)) { |
|
| 960 | + if (!empty($matches)) { |
|
| 961 | 961 | if ($wantsAlias) { |
| 962 | 962 | return array_pop($matches); |
| 963 | 963 | } else { |
@@ -164,7 +164,7 @@ |
||
| 164 | 164 | $name = str_replace('/', '\\', $name); |
| 165 | 165 | } |
| 166 | 166 | |
| 167 | - if (! Str::contains(Str::lower($name), 'datatable')) { |
|
| 167 | + if (!Str::contains(Str::lower($name), 'datatable')) { |
|
| 168 | 168 | $name .= 'DataTable'; |
| 169 | 169 | } |
| 170 | 170 | |
@@ -149,7 +149,7 @@ |
||
| 149 | 149 | /** |
| 150 | 150 | * Get columns definition from html builder. |
| 151 | 151 | * |
| 152 | - * @return array |
|
| 152 | + * @return \Illuminate\Support\Collection |
|
| 153 | 153 | */ |
| 154 | 154 | protected function getColumnsFromBuilder() |
| 155 | 155 | { |
@@ -335,10 +335,10 @@ |
||
| 335 | 335 | $orientation = Config::get('datatables.snappy.orientation', 'landscape'); |
| 336 | 336 | |
| 337 | 337 | $snappy->setOptions($options) |
| 338 | - ->setOrientation($orientation); |
|
| 338 | + ->setOrientation($orientation); |
|
| 339 | 339 | |
| 340 | 340 | return $snappy->loadHTML($this->printPreview()) |
| 341 | - ->download($this->getFilename() . ".pdf"); |
|
| 341 | + ->download($this->getFilename() . ".pdf"); |
|
| 342 | 342 | } |
| 343 | 343 | |
| 344 | 344 | /** |
@@ -325,7 +325,7 @@ |
||
| 325 | 325 | /** @var \Barryvdh\Snappy\PdfWrapper $snappy */ |
| 326 | 326 | $snappy = app('snappy.pdf.wrapper'); |
| 327 | 327 | |
| 328 | - $options = Config::get('datatables.snappy.options', [ |
|
| 328 | + $options = Config::get('datatables.snappy.options', [ |
|
| 329 | 329 | 'no-outline' => true, |
| 330 | 330 | 'margin-left' => '0', |
| 331 | 331 | 'margin-right' => '0', |
@@ -347,7 +347,7 @@ discard block |
||
| 347 | 347 | */ |
| 348 | 348 | public function getTableAttribute($attribute) |
| 349 | 349 | { |
| 350 | - if (! array_key_exists($attribute, $this->tableAttributes)) { |
|
| 350 | + if (!array_key_exists($attribute, $this->tableAttributes)) { |
|
| 351 | 351 | throw new \Exception("Table attribute '{$attribute}' does not exist."); |
| 352 | 352 | } |
| 353 | 353 | |
@@ -389,7 +389,7 @@ discard block |
||
| 389 | 389 | public function columns(array $columns) |
| 390 | 390 | { |
| 391 | 391 | foreach ($columns as $key => $value) { |
| 392 | - if (! is_a($value, Column::class)) { |
|
| 392 | + if (!is_a($value, Column::class)) { |
|
| 393 | 393 | if (is_array($value)) { |
| 394 | 394 | $attributes = array_merge(['name' => $key, 'data' => $key], $this->setTitle($key, $value)); |
| 395 | 395 | } else { |
@@ -418,7 +418,7 @@ discard block |
||
| 418 | 418 | */ |
| 419 | 419 | public function setTitle($title, array $attributes) |
| 420 | 420 | { |
| 421 | - if (! isset($attributes['title'])) { |
|
| 421 | + if (!isset($attributes['title'])) { |
|
| 422 | 422 | $attributes['title'] = $this->getQualifiedTitle($title); |
| 423 | 423 | } |
| 424 | 424 | |