الصفحات · Laravilt
Filters
Filter types for the query builder and the options they share.
Filters live in Laravilt\QueryBuilder\Filters:
- Text Filter: contains, exact, starts with, ends with
- Select Filter: single or multiple values
- Boolean Filter: true/false
- Date Filter: equal, before, after, between
Shared methods
php
| Method | Description |
|---|---|
make(string $name) | Create a filter; the name is also the default column |
label(string) | Display label (defaults to the headline form of the name) |
column(string) | Database column |
default(mixed) | Default value (serialized for the frontend) |
placeholder(string) | Placeholder text |
visible(bool) | Show or hide the filter |
query(Closure) | Replace the default constraint |
Custom query
query() receives the builder and the value, and replaces the filter's default constraint:
php
To build your own filter type, extend Laravilt\QueryBuilder\Filters\Filter and implement applyDefault(Builder $query, mixed $value): void.