diff --git a/src/Query/Grammar.php b/src/Query/Grammar.php index 936430ab..0506c983 100644 --- a/src/Query/Grammar.php +++ b/src/Query/Grammar.php @@ -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); } @@ -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) {