الصفحات · Laravilt
SelectFilter
Filter records by one or more values from a list or relationship.
php
By default the filter runs where(name, value), or whereIn when multiple() is enabled.
Multiple selection
php
Relationship
Options load from the relationship, and the query uses whereHas:
php
Custom query
The closure receives the query and the selected value:
php
API reference
| Method | Description |
|---|---|
options() | Array or closure of options |
multiple() | Allow several values |
searchable() | Searchable dropdown |
relationship() | Load options from a relationship |
preload() | Preload relationship options |
hasEmptyOption(), emptyRelationshipOptionLabel() | "None" option for relationships |
selectablePlaceholder() | Allow clearing the selection |
query() | Custom query |
default() | Default value |