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+.
When specifying the target of a json database field you can specify wildcards in the json path.
public function allowedFilters(): AllowedFilterList
{
return Filter::only(
Filter::field('data->*->array', [FilterType::JSON_CONTAINS]),
);
}
/*
* Allows:
*/
$filters = [
[
'type' => '$jsonContains',
'target' => 'data->languages->array',
'value' => [
'en',
'de',
]
]
];
How can I help you explore Laravel packages today?