indexzer0/eloquent-filtering
Filter Laravel Eloquent models using simple arrays and request data—no custom query spaghetti. Define allowed filters on your models, support complex search, and keep queries readable, maintainable, and easy to extend for APIs and dashboards.
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?