Field Filters
Between Columns
Introduction
Basics
- Installation
- Make Model Filterable
- Filtering Models
- Allowing Filters
- Relationships
Available Filters
- Full Filter List
- Field Filters
- Relation Filters
- Morph Relation Filters
- Condition Filters
Digging Deeper
Field Filters
Between Columns
Definition
Filter::field('price', [FilterType::BETWEEN_COLUMNS]);
Array/Object Structure
target
string
requiredvalue
array,size:2
requiredvalue.*
string
requiredExample
$filter = [
'type' => '$betweenColumns',
'target' => 'price',
'value' => [
'min_allowed_price',
'max_allowed_price',
],
];
$sql = Product::filter([$filter])->toRawSql();
SQL
select
*
from
"products"
where
"products"."price" between "products"."min_allowed_price"
and "products"."max_allowed_price"
Modifiers
None available.