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('description', [FilterType::LIKE])
import TypeParameterField from '/snippets/type-parameter-field.mdx';
import TargetParameterField from '/snippets/target-parameter-field.mdx';
$filter = [
'type' => '$like',
'target' => 'description',
'value' => 'Laravel',
];
$sql = Project::filter([$filter])->toRawSql();
select * from "projects" where "projects"."description" LIKE '%Laravel%'
select * from "projects" where "projects"."description" LIKE 'Laravel%'
select * from "projects" where "projects"."description" LIKE '%Laravel'
How can I help you explore Laravel packages today?