Filament allows us to build complex filter systems, so how about a Real Estate search? This example showcases the combined search for houses for sale and rent while hiding and displaying fields based on another filter.
The table has two custom filters. Custom filters are needed to use Form Builder to create custom-dependent deferred filters.
The filters are set to defer, the layout is set to AboveContent
, and the filters form columns are set to three.
->filters([ // ...], Tables\Enums\FiltersLayout::AboveContent)->deferFilters()->filtersFormColumns(3)
The first filter is to choose the type sale
or rent
.
Tables\Filters\Filter::make('type') ->form([ Forms\Components\Fieldset::make('Type') ->schema([ Forms\Components\Select::make('type') ->hiddenLabel() ->live() ->options([ 'sale' => 'For Sale', 'rent' => 'For Rent', ]), ]), // ...