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+.
import ConditionFiltersNote from '/snippets/condition-filters-note.mdx';
import TypeParameterField from '/snippets/type-parameter-field.mdx';
$filter = [
'type' => '$and',
'value' => [
[
'type' => '$like',
'target' => 'content',
'value' => 'is awesome',
],
[
'type' => '$like',
'target' => 'content',
'value' => 'is not boring',
]
]
];
$sql = Comment::filter([$filter])->toRawSql();
select *
from "comments"
where (
("comments"."content" LIKE '%is awesome%')
and
("comments"."content" LIKE '%is not boring%')
)
None available.
How can I help you explore Laravel packages today?