Overview
TheSelectFilter class provides a dropdown filter with customizable options. It supports single or multiple selection, searchable dropdowns, and parent-child dependencies for cascading filters.
Creating a SelectFilter
Available Methods
setOptions
Sets the available options for the dropdown.
An associative array where keys are values and values are labels
label
placeholder
multiple
Enables multiple selection mode (uses
whereIn query).searchable
Renders an Alpine-powered dropdown with text search instead of a native select element.
The
searchable() method is not supported on filters with parent() dependency. Dependent filters use a native select that updates automatically when the parent value changes.parent
Sets a parent filter dependency for cascading filters.
The key of the parent filter
parentFilter
Defines the callback that generates options based on the parent filter’s value.
A closure that receives the parent’s value and returns an options array
filter
Provides a custom query callback to override the default filter behavior.
A closure that receives
Builder $query and mixed $value and returns the modified Builderkey
initialValue
Sets an initial value that is pre-applied when the table first loads.
The initial value (or array of values for multiple selection)
groupClass / labelClass / inputClass
Sets CSS classes for the filter wrapper, label, or input element.
Default Behavior
Single selection:Dependent Filters Example
Create cascading filters where child options depend on parent selection:- The child filter is automatically reset
- New options are loaded via
parentFiltercallback - The child dropdown updates reactively