Field Filters
Like
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
Like
Definition
Filter::field('description', [FilterType::LIKE])
Array/Object Structure
target
string
requiredvalue
string|int|float
requiredExample
$filter = [
'type' => '$like',
'target' => 'description',
'value' => 'Laravel',
];
$sql = Project::filter([$filter])->toRawSql();
SQL
select * from "projects" where "projects"."description" LIKE '%Laravel%'
Modifiers
Start
select * from "projects" where "projects"."description" LIKE 'Laravel%'
End
select * from "projects" where "projects"."description" LIKE '%Laravel'