@@ -276,7 +276,7 @@ discard block |
||
| 276 | 276 | if ($filepath === $filePath) { |
| 277 | 277 | continue; |
| 278 | 278 | } |
| 279 | - $this->validSubModels[ camelcase(pathinfo($filepath, PATHINFO_FILENAME)) ] = $filepath; |
|
| 279 | + $this->validSubModels[camelcase(pathinfo($filepath, PATHINFO_FILENAME))] = $filepath; |
|
| 280 | 280 | } |
| 281 | 281 | } |
| 282 | 282 | } |
@@ -344,7 +344,7 @@ discard block |
||
| 344 | 344 | } |
| 345 | 345 | } |
| 346 | 346 | |
| 347 | - if (empty($get[ $property ])) { |
|
| 347 | + if (empty($get[$property])) { |
|
| 348 | 348 | if (services()->has($property)) { |
| 349 | 349 | return services()->get($property); |
| 350 | 350 | } elseif ($this->hasSubModel($property)) { |
@@ -371,7 +371,7 @@ discard block |
||
| 371 | 371 | final protected function hasSubModel($model) |
| 372 | 372 | { |
| 373 | 373 | if (array_key_exists($model, $this->validSubModels)) { |
| 374 | - return (bool)is_file($this->validSubModels[ $model ]); |
|
| 374 | + return (bool)is_file($this->validSubModels[$model]); |
|
| 375 | 375 | } |
| 376 | 376 | |
| 377 | 377 | return false; |
@@ -432,7 +432,7 @@ discard block |
||
| 432 | 432 | */ |
| 433 | 433 | final public function rebuildRowCallback(\Closure $callback) |
| 434 | 434 | { |
| 435 | - if(empty($this->rebuildRowCallback)) { |
|
| 435 | + if (empty($this->rebuildRowCallback)) { |
|
| 436 | 436 | $this->rebuildRowCallback = $callback; |
| 437 | 437 | } |
| 438 | 438 | } |
@@ -472,7 +472,7 @@ discard block |
||
| 472 | 472 | */ |
| 473 | 473 | public function rebuildRow($row) |
| 474 | 474 | { |
| 475 | - if(is_callable($this->rebuildRowCallback)) { |
|
| 475 | + if (is_callable($this->rebuildRowCallback)) { |
|
| 476 | 476 | call_user_func($this->rebuildRowCallback, $row); |
| 477 | 477 | } |
| 478 | 478 | } |
@@ -338,8 +338,8 @@ discard block |
||
| 338 | 338 | $conditions = []; |
| 339 | 339 | |
| 340 | 340 | foreach ($this->paramsWithRules as $param) { |
| 341 | - if ($get->offsetExists($param[ 'field' ])) { |
|
| 342 | - $conditions[ $param[ 'field' ] ] = $get->offsetGet($param[ 'field' ]); |
|
| 341 | + if ($get->offsetExists($param['field'])) { |
|
| 342 | + $conditions[$param['field']] = $get->offsetGet($param['field']); |
|
| 343 | 343 | } |
| 344 | 344 | } |
| 345 | 345 | |
@@ -426,22 +426,22 @@ discard block |
||
| 426 | 426 | } |
| 427 | 427 | |
| 428 | 428 | if ($columns = input()->request('columns')) { |
| 429 | - if (isset($columns[ $number ])) { |
|
| 430 | - if (isset($columns[ $number ][ 'searchable' ])) { |
|
| 431 | - if ($columns[ $number ][ 'searchable' ] === 'true') { |
|
| 429 | + if (isset($columns[$number])) { |
|
| 430 | + if (isset($columns[$number]['searchable'])) { |
|
| 431 | + if ($columns[$number]['searchable'] === 'true') { |
|
| 432 | 432 | if ($search = input()->request('search')) { |
| 433 | - if (isset($search[ 'value' ])) { |
|
| 434 | - $this->model->qb->orLike($field, $search[ 'value' ]); |
|
| 433 | + if (isset($search['value'])) { |
|
| 434 | + $this->model->qb->orLike($field, $search['value']); |
|
| 435 | 435 | } |
| 436 | 436 | } |
| 437 | 437 | } |
| 438 | 438 | } |
| 439 | 439 | |
| 440 | - if (isset($columns[ $number ][ 'orderable' ])) { |
|
| 441 | - if ($columns[ $number ][ 'orderable' ] === 'true') { |
|
| 440 | + if (isset($columns[$number]['orderable'])) { |
|
| 441 | + if ($columns[$number]['orderable'] === 'true') { |
|
| 442 | 442 | if ($order = input()->request('order')) { |
| 443 | - if (isset($order[ $number ][ 'dir' ])) { |
|
| 444 | - $this->model->orderBy($field, strtoupper($order[ $number ][ 'dir' ])); |
|
| 443 | + if (isset($order[$number]['dir'])) { |
|
| 444 | + $this->model->orderBy($field, strtoupper($order[$number]['dir'])); |
|
| 445 | 445 | } |
| 446 | 446 | } |
| 447 | 447 | } |
@@ -452,13 +452,13 @@ discard block |
||
| 452 | 452 | $i++; |
| 453 | 453 | } |
| 454 | 454 | |
| 455 | - $this->model->rebuildRowCallback(function ($row) { |
|
| 455 | + $this->model->rebuildRowCallback(function($row) { |
|
| 456 | 456 | $row->DT_RowId = 'datatable-row-' . $row->id; |
| 457 | 457 | |
| 458 | 458 | foreach ($this->dataTableColumns as $number => $column) { |
| 459 | 459 | if (is_array($column)) { |
| 460 | - if (isset($column[ 'formatter' ])) { |
|
| 461 | - call_user_func($column[ 'formatter' ], $row); |
|
| 460 | + if (isset($column['formatter'])) { |
|
| 461 | + call_user_func($column['formatter'], $row); |
|
| 462 | 462 | } |
| 463 | 463 | } |
| 464 | 464 | } |
@@ -468,22 +468,22 @@ discard block |
||
| 468 | 468 | // Search value |
| 469 | 469 | foreach ($this->model->visibleColumns as $number => $field) { |
| 470 | 470 | if ($columns = input()->request('columns')) { |
| 471 | - if (isset($columns[ $number ])) { |
|
| 472 | - if (isset($columns[ $number ][ 'searchable' ])) { |
|
| 473 | - if ($columns[ $number ][ 'searchable' ] === 'true') { |
|
| 471 | + if (isset($columns[$number])) { |
|
| 472 | + if (isset($columns[$number]['searchable'])) { |
|
| 473 | + if ($columns[$number]['searchable'] === 'true') { |
|
| 474 | 474 | if ($search = input()->request('search')) { |
| 475 | - if (isset($search[ 'value' ])) { |
|
| 476 | - $this->model->qb->orLike($field, $search[ 'value' ]); |
|
| 475 | + if (isset($search['value'])) { |
|
| 476 | + $this->model->qb->orLike($field, $search['value']); |
|
| 477 | 477 | } |
| 478 | 478 | } |
| 479 | 479 | } |
| 480 | 480 | } |
| 481 | 481 | |
| 482 | - if (isset($columns[ $number ][ 'orderable' ])) { |
|
| 483 | - if ($columns[ $number ][ 'orderable' ] === 'true') { |
|
| 482 | + if (isset($columns[$number]['orderable'])) { |
|
| 483 | + if ($columns[$number]['orderable'] === 'true') { |
|
| 484 | 484 | if ($order = input()->request('order')) { |
| 485 | - if (isset($order[ $number ][ 'dir' ])) { |
|
| 486 | - $this->model->orderBy($field, strtoupper($order[ $number ][ 'dir' ])); |
|
| 485 | + if (isset($order[$number]['dir'])) { |
|
| 486 | + $this->model->orderBy($field, strtoupper($order[$number]['dir'])); |
|
| 487 | 487 | } |
| 488 | 488 | } |
| 489 | 489 | } |
@@ -492,7 +492,7 @@ discard block |
||
| 492 | 492 | } |
| 493 | 493 | } |
| 494 | 494 | |
| 495 | - $this->model->rebuildRowCallback(function ($row) { |
|
| 495 | + $this->model->rebuildRowCallback(function($row) { |
|
| 496 | 496 | $row->DT_RowId = 'datatable-row-' . $row->id; |
| 497 | 497 | }); |
| 498 | 498 | } |
@@ -527,8 +527,8 @@ discard block |
||
| 527 | 527 | $conditions = []; |
| 528 | 528 | |
| 529 | 529 | foreach ($this->paramsWithRules as $param) { |
| 530 | - if ($get->offsetExists($param[ 'field' ])) { |
|
| 531 | - $conditions[ $param[ 'field' ] ] = $get->offsetGet($param[ 'field' ]); |
|
| 530 | + if ($get->offsetExists($param['field'])) { |
|
| 531 | + $conditions[$param['field']] = $get->offsetGet($param['field']); |
|
| 532 | 532 | } |
| 533 | 533 | } |
| 534 | 534 | |
@@ -607,14 +607,14 @@ discard block |
||
| 607 | 607 | |
| 608 | 608 | if (count($this->fillableColumnsWithRules)) { |
| 609 | 609 | foreach ($this->fillableColumnsWithRules as $column) { |
| 610 | - if ($post->offsetExists($column[ 'field' ])) { |
|
| 611 | - $data[ $column[ 'field' ] ] = $post->offsetGet($column[ 'field' ]); |
|
| 610 | + if ($post->offsetExists($column['field'])) { |
|
| 611 | + $data[$column['field']] = $post->offsetGet($column['field']); |
|
| 612 | 612 | } |
| 613 | 613 | } |
| 614 | 614 | } elseif (count($this->fillableColumns)) { |
| 615 | 615 | foreach ($this->fillableColumns as $column) { |
| 616 | - if ($post->offsetExists($column[ 'field' ])) { |
|
| 617 | - $data[ $column[ 'field' ] ] = $post->offsetGet($column[ 'field' ]); |
|
| 616 | + if ($post->offsetExists($column['field'])) { |
|
| 617 | + $data[$column['field']] = $post->offsetGet($column['field']); |
|
| 618 | 618 | } |
| 619 | 619 | } |
| 620 | 620 | } else { |
@@ -622,11 +622,11 @@ discard block |
||
| 622 | 622 | } |
| 623 | 623 | |
| 624 | 624 | if (count($data)) { |
| 625 | - $data[ 'record_create_timestamp' ] = $data[ 'record_update_timestamp' ] = timestamp(); |
|
| 626 | - $data[ 'record_create_user' ] = $data[ 'record_update_user' ] = globals()->account->id; |
|
| 625 | + $data['record_create_timestamp'] = $data['record_update_timestamp'] = timestamp(); |
|
| 626 | + $data['record_create_user'] = $data['record_update_user'] = globals()->account->id; |
|
| 627 | 627 | |
| 628 | 628 | if ($this->model->insert($data)) { |
| 629 | - $data[ 'id' ] = $this->model->db->getLastInsertId(); |
|
| 629 | + $data['id'] = $this->model->db->getLastInsertId(); |
|
| 630 | 630 | $this->sendPayload([ |
| 631 | 631 | 'code' => 201, |
| 632 | 632 | 'Successful insert request', |
@@ -685,14 +685,14 @@ discard block |
||
| 685 | 685 | |
| 686 | 686 | if (count($this->fillableColumnsWithRules)) { |
| 687 | 687 | foreach ($this->fillableColumnsWithRules as $column) { |
| 688 | - if ($post->offsetExists($column[ 'field' ])) { |
|
| 689 | - $data[ $column[ 'field' ] ] = $post->offsetGet($column[ 'field' ]); |
|
| 688 | + if ($post->offsetExists($column['field'])) { |
|
| 689 | + $data[$column['field']] = $post->offsetGet($column['field']); |
|
| 690 | 690 | } |
| 691 | 691 | } |
| 692 | 692 | } elseif (count($this->fillableColumns)) { |
| 693 | 693 | foreach ($this->fillableColumns as $column) { |
| 694 | - if ($post->offsetExists($column[ 'field' ])) { |
|
| 695 | - $data[ $column[ 'field' ] ] = $post->offsetGet($column[ 'field' ]); |
|
| 694 | + if ($post->offsetExists($column['field'])) { |
|
| 695 | + $data[$column['field']] = $post->offsetGet($column['field']); |
|
| 696 | 696 | } |
| 697 | 697 | } |
| 698 | 698 | } else { |
@@ -700,8 +700,8 @@ discard block |
||
| 700 | 700 | } |
| 701 | 701 | |
| 702 | 702 | if (count($data)) { |
| 703 | - $data[ 'record_update_timestamp' ] = timestamp(); |
|
| 704 | - $data[ 'record_update_user' ] = globals()->account->id; |
|
| 703 | + $data['record_update_timestamp'] = timestamp(); |
|
| 704 | + $data['record_update_user'] = globals()->account->id; |
|
| 705 | 705 | |
| 706 | 706 | |
| 707 | 707 | if ($this->model->update($data, $conditions)) { |
@@ -861,9 +861,9 @@ discard block |
||
| 861 | 861 | if (is_numeric(key($code))) { |
| 862 | 862 | $message = reset($code); |
| 863 | 863 | $code = key($code); |
| 864 | - } elseif (isset($code[ 'code' ])) { |
|
| 865 | - $code = $code[ 'code' ]; |
|
| 866 | - $message = $code[ 'message' ]; |
|
| 864 | + } elseif (isset($code['code'])) { |
|
| 865 | + $code = $code['code']; |
|
| 866 | + $message = $code['message']; |
|
| 867 | 867 | } |
| 868 | 868 | } |
| 869 | 869 | |
@@ -931,7 +931,7 @@ discard block |
||
| 931 | 931 | $longPoolingCacheMetadata = $longPoolingCacheData->getMetadata(); |
| 932 | 932 | |
| 933 | 933 | // if no timestamp delivered via ajax or data.txt has been changed SINCE last ajax timestamp |
| 934 | - if ($lastCallTimestamp == null || $longPoolingCacheMetadata[ 'ctime' ] > $lastCallTimestamp) { |
|
| 934 | + if ($lastCallTimestamp == null || $longPoolingCacheMetadata['ctime'] > $lastCallTimestamp) { |
|
| 935 | 935 | output()->send([ |
| 936 | 936 | 'timestamp' => $longPoolingCacheMetadata, |
| 937 | 937 | 'data' => $data, |