Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 10 additions & 1 deletion src/Concerns/FiltersQuery.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,15 @@ trait FiltersQuery
{
protected Collection $allowedFilters;

protected bool $throwFilterExceptions = true;

public function throwFilterExceptions(bool $throw = true): static
{
$this->throwFilterExceptions = $throw;

return $this;
}

public function allowedFilters($filters): static
{
$filters = is_array($filters) ? $filters : func_get_args();
Expand Down Expand Up @@ -60,7 +69,7 @@ protected function isFilterRequested(AllowedFilter $allowedFilter): bool

protected function ensureAllFiltersExist(): void
{
if (config('query-builder.disable_invalid_filter_query_exception', false)) {
if (config('query-builder.disable_invalid_filter_query_exception', false) || ! $this->throwFilterExceptions) {
return;
}

Expand Down