indexzer0/eloquent-filtering
Define allowed filters on your Eloquent models and apply them from simple arrays or request data—no custom query logic. Supports complex, type-based filtering for APIs and dashboards on Laravel 10+ / PHP 8.2+.
Filter::field('name', [FilterType::NOT_IN]);
import TypeParameterField from '/snippets/type-parameter-field.mdx';
import TargetParameterField from '/snippets/target-parameter-field.mdx';
$filter = [
'type' => '$notIn',
'target' => 'name',
'value' => ['Nuno', 'Maduro',]
];
$sql = Person::filter([$filter])->toRawSql();
select * from "people" where "people"."name" not in ('Nuno', 'Maduro')
select *
from "people"
where (
"people"."name" not in ('Nuno', 'Maduro')
and
"people"."name" is not null
)
How can I help you explore Laravel packages today?