- Max filter amount
- Max nested depth. (for protection against
$or
and$and
nesting). - Disable/enable
$or
and$and
globally.
$filter = [
'target' => 'column',
'type' => '$where',
'operator' => '=', // Rule::in(['=', '<', '<=', '>', '>='])
'value' => 'value',
],
$trashed
- for soft deletes.
// e.g.
$filter = [
'type' => '$trashed',
'value' => 'all' | 'true' | 'false'
]
$filter = [
'type' => '$onlyTrashed'
]
$filter = [
'type' => '$withTrashed'
]
$latest
- for order by.
// e.g.
$filter = [
'type' => '$latest',
'value' => 'created_at',
]
$filter = [
'type' => '$latest'
]
$empty
/$blank
.
$filter = [
'type' => '$empty'
]
// where column = '' or column is null
$filled
.
$filter = [
'type' => '$filled'
]
// where column != '' and column is not null
Filter::scope('active')
// Would call $model->active() - ( scopeActive() )
A way to use a filter without specifying the type?
- Something like:
Filter::field('name', [FilterType::EQUALS, FilterType::LIKE])
->default(FilterType::EQUALS)
- Ability to define multiple sets of allowed filters that can be used in different parts of an application.
- Define filters in dedicated classes and register them on model.
- Ability to apply the relationship filters to a join.
- Sort by relationship column.