diff --git a/src/Filters/GlobalFilter.php b/src/Filters/GlobalFilter.php index ad034a9..1f0f316 100644 --- a/src/Filters/GlobalFilter.php +++ b/src/Filters/GlobalFilter.php @@ -5,7 +5,6 @@ use Illuminate\Contracts\Database\Query\Expression; use Illuminate\Database\Eloquent\Builder; use Illuminate\Support\Collection; -use Kirschbaum\PowerJoins\FakeJoinCallback; use Spatie\QueryBuilder\AllowedFilter; use Spatie\QueryBuilder\Filters\Filter; use TeamQ\QueryBuilder\Concerns\HasPropertyRelationship; @@ -34,7 +33,7 @@ class GlobalFilter implements Filter public function __construct( array $fields, bool $addRelationConstraint = true, - JoinType $joinType = null, + ?JoinType $joinType = null, array|string|null $joinAliases = null ) { $this->fields = $fields; @@ -49,7 +48,7 @@ public function __construct( public static function allowed( array $fields, bool $addRelationConstraint = true, - JoinType $joinType = null, + ?JoinType $joinType = null, string $name = 'global', ): AllowedFilter { return AllowedFilter::custom($name, new static($fields, $addRelationConstraint, $joinType)); diff --git a/tests/Sorts/RelationSortTest.php b/tests/Sorts/RelationSortTest.php index e0fcc36..267994d 100644 --- a/tests/Sorts/RelationSortTest.php +++ b/tests/Sorts/RelationSortTest.php @@ -170,7 +170,7 @@ ]); expect($queryBuilder->toSql()) - ->toBe("select `books`.*, sum(chapters_alias.number) as chapters_alias_number_sum from `books` left join `chapters` as `chapters_alias` on `chapters_alias`.`book_id` = `books`.`id` group by `books`.`id` order by chapters_alias_number_sum desc") + ->toBe('select `books`.*, sum(chapters_alias.number) as chapters_alias_number_sum from `books` left join `chapters` as `chapters_alias` on `chapters_alias`.`book_id` = `books`.`id` group by `books`.`id` order by chapters_alias_number_sum desc') ->and($queryBuilder->get()) ->sequence( fn ($book) => $book->title->toBe('Laravel Beyond Crud'), @@ -194,7 +194,7 @@ ]); expect($queryBuilder->toSql()) - ->toBe("select `countries`.* from `countries` inner join `authors` as `authors_alias` on `authors_alias`.`country_id` = `countries`.`id` inner join `books` as `books_alias` on `books_alias`.`author_id` = `authors_alias`.`id` order by `books_alias`.`order` asc") + ->toBe('select `countries`.* from `countries` inner join `authors` as `authors_alias` on `authors_alias`.`country_id` = `countries`.`id` inner join `books` as `books_alias` on `books_alias`.`author_id` = `authors_alias`.`id` order by `books_alias`.`order` asc') ->and($queryBuilder->get()) ->sequence( fn ($country) => $country->code->toBe('US'),