Páginas · Laravilt
Filters
Filter table records with select, ternary, trashed, and custom filters.
Filters live in the Laravilt\Tables\Filters namespace. Pass them to $table->filters([...]).
| Filter | Purpose |
|---|---|
| SelectFilter | Pick one or more values, optionally from a relationship |
| TernaryFilter | Yes / No / All |
| TrashedFilter | Include or show only soft-deleted records |
QueryFilter | A toggle that applies a custom query when switched on |
Filter | Any form field plus your own query |
php
Toggle filters
php
Custom form filters
Use any form field as the filter input. The query closure receives the query and the submitted value:
php
Shared options
| Method | Description |
|---|---|
label() | Filter label |
default() | Default value |
attribute() | Database column when it differs from the filter name |
query() | Custom query: fn ($query, $value) => ... |
indicateUsing() | Active-filter badge text: fn ($value) => "Status: {$value}" |
form() / schema() | Custom form field(s) |
Layout
php