diff --git a/src/DatatableInput.php b/src/DatatableInput.php index 4e56022..6196e21 100644 --- a/src/DatatableInput.php +++ b/src/DatatableInput.php @@ -15,8 +15,7 @@ public function __construct( private array $rels, private array $allowedFilters, private array $allowedSortings, - ) { - } + ) {} public function getStart(): int { diff --git a/src/DatatableService.php b/src/DatatableService.php index 9f0b2df..1ab6117 100644 --- a/src/DatatableService.php +++ b/src/DatatableService.php @@ -8,19 +8,20 @@ class DatatableService { - protected array $allowedFilters; + protected array $allowedRelations; + protected array $allowedSortings; + protected array $allowedSelects; + private int $totalRowCount; public function __construct( - protected Builder $query, + protected Builder $query, private DatatableInput $dataTableInput - ) - { - } + ) {} public function setAllowedFilters(array $allowedFilters): DatatableService { @@ -55,12 +56,12 @@ public function getData(): array $query = $this->buildQuery(); $data = $query->get()->toArray(); - return array( + return [ 'data' => $data, 'meta' => [ - 'totalRowCount' => $this->totalRowCount - ] - ); + 'totalRowCount' => $this->totalRowCount, + ], + ]; } protected function buildQuery(): Builder diff --git a/src/DatatableServiceProvider.php b/src/DatatableServiceProvider.php index b1945f4..49a9f08 100644 --- a/src/DatatableServiceProvider.php +++ b/src/DatatableServiceProvider.php @@ -2,7 +2,6 @@ namespace HamidRrj\LaravelDatatable; -use HamidRrj\LaravelDatatable\Commands\LaravelDatatableCommand; use Spatie\LaravelPackageTools\Package; use Spatie\LaravelPackageTools\PackageServiceProvider; diff --git a/src/Exceptions/InvalidParameterInterface.php b/src/Exceptions/InvalidParameterInterface.php index afa33cf..95f5a88 100644 --- a/src/Exceptions/InvalidParameterInterface.php +++ b/src/Exceptions/InvalidParameterInterface.php @@ -2,6 +2,4 @@ namespace HamidRrj\LaravelDatatable\Exceptions; -interface InvalidParameterInterface -{ -} +interface InvalidParameterInterface {} diff --git a/src/Filter/ApplyFilter.php b/src/Filter/ApplyFilter.php index 68861a2..8df4fe4 100644 --- a/src/Filter/ApplyFilter.php +++ b/src/Filter/ApplyFilter.php @@ -20,8 +20,7 @@ class ApplyFilter public function __construct( private Builder $query, private Filter $filter, - ) { - } + ) {} public function apply(): Builder { diff --git a/src/Filter/SearchFunctions/SearchFilter.php b/src/Filter/SearchFunctions/SearchFilter.php index 2fd8102..b5df0a6 100644 --- a/src/Filter/SearchFunctions/SearchFilter.php +++ b/src/Filter/SearchFunctions/SearchFilter.php @@ -10,8 +10,7 @@ abstract class SearchFilter public function __construct( protected Builder $query, protected Filter $filter, - ) { - } + ) {} abstract public function apply(): Builder; } diff --git a/src/Sort/ApplySort.php b/src/Sort/ApplySort.php index 514103c..12e6108 100644 --- a/src/Sort/ApplySort.php +++ b/src/Sort/ApplySort.php @@ -12,8 +12,7 @@ class ApplySort public function __construct( private Builder $query, private ?Sort $sort, - ) { - } + ) {} public function apply(): Builder { diff --git a/src/Sort/Sort.php b/src/Sort/Sort.php index 781d81d..5d27b11 100644 --- a/src/Sort/Sort.php +++ b/src/Sort/Sort.php @@ -16,17 +16,13 @@ class Sort */ public function __construct( private string $id, - private bool $desc, + private bool $desc, private array $allowedSortings, - ) - { + ) { self::$sortingValidator = SortingValidator::getInstance(); self::$sortingValidator->isValid($this, $this->allowedSortings); } - /** - * @return string - */ public function getId(): string { return $this->id; diff --git a/src/Validators/FilterValidator.php b/src/Validators/FilterValidator.php index 173b410..d8342da 100644 --- a/src/Validators/FilterValidator.php +++ b/src/Validators/FilterValidator.php @@ -11,9 +11,7 @@ class FilterValidator { private static $instance; - private function __construct() - { - } + private function __construct() {} public static function getInstance(): FilterValidator { diff --git a/src/Validators/SortingValidator.php b/src/Validators/SortingValidator.php index 270c019..8f62a00 100644 --- a/src/Validators/SortingValidator.php +++ b/src/Validators/SortingValidator.php @@ -9,9 +9,7 @@ class SortingValidator { private static $instance; - private function __construct() - { - } + private function __construct() {} public static function getInstance(): SortingValidator { diff --git a/tests/TestCase.php b/tests/TestCase.php index 524eecb..091b310 100644 --- a/tests/TestCase.php +++ b/tests/TestCase.php @@ -28,7 +28,6 @@ public function getEnvironmentSetUp($app) { config()->set('database.default', 'testing'); - $migration = include __DIR__.'/../database/migrations/create_users_table.php.stub'; $migration->up();