platform
platform copied to clipboard
[13.0] Shorten Filters
Is your feature request related to a problem? Please describe.
It seems strange to me to specify HTTP filters and Eloquent filter separately, for example:
public function query(): iterable
{
return [
'users' => User::with('roles')
->filters(UserFiltersLayout::class)
->filtersApplySelection(UserFiltersLayout::class)
->defaultSort('id', 'desc')
->paginate(),
];
}
Describe the solution you'd like
We could use an argument to automatically call it later inside the class:
public function query(): iterable
{
return [
'users' => User::with('roles')
->filters(UserFiltersLayout::class)
->defaultSort('id', 'desc')
->paginate(),
];
}
Additional context
I find the risk of current and future problems very small. This will also work with passing a separate array with filters:
public function query(): iterable
{
return [
'users' => User::with('roles')
->filters([
RoleFilter::class,
])
->defaultSort('id', 'desc')
->paginate(),
];
}
As this issue is referenced in a commit I will close it.