Skip to content

Commit

Permalink
Handle possibility of null filter types
Browse files Browse the repository at this point in the history
  • Loading branch information
stevebauman committed Oct 15, 2024
1 parent 9b5f53d commit 2f98dca
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/Query/Grammar.php
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ protected function compileWheres(Builder $builder, string $type = 'and'): string
{
$filter = '';

foreach ($builder->filters[$type] as $where) {
foreach ($builder->filters[$type] ?? [] as $where) {
$filter .= $this->compileWhere($where);
}

Expand Down Expand Up @@ -169,7 +169,7 @@ protected function has(Builder $query, array|string $type, string $operator = '>
$filters = 0;

foreach ($types as $type) {
$filters += count($query->filters[$type]);
$filters += count($query->filters[$type] ?? []);
}

return match ($operator) {
Expand Down

0 comments on commit 2f98dca

Please sign in to comment.