© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
FilamentF
Filament•3y ago•
7 replies
Sidem

default select on relationship

Hello, i would like put a default value for my filter select but that didn"t works :

SelectFilter::make('exercice')
                    ->label('Exercice')
                    ->relationship('exercice', 'name', fn($query) => $query->orderBy('id', 'desc') )
                    ->default(2022)
                    ->searchable()
                    ->multiple()
                    ->preload(),
SelectFilter::make('exercice')
                    ->label('Exercice')
                    ->relationship('exercice', 'name', fn($query) => $query->orderBy('id', 'desc') )
                    ->default(2022)
                    ->searchable()
                    ->multiple()
                    ->preload(),


The table Exercice looks like :
image.png
Solution
It is multiple, try:

->default([1])
Jump to solution
Filament banner
FilamentJoin
A powerful open source UI framework for Laravel • Build and ship admin panels & apps fast with Livewire
20,307Members
Resources
Was this page helpful?

Similar Threads

Recent Announcements

Similar Threads

Select default relationship
FilamentFFilament / ❓┊help
2y ago
Select with relationship default
FilamentFFilament / ❓┊help
3y ago
Select with relationship and default value
FilamentFFilament / ❓┊help
2y ago
Select relationship
FilamentFFilament / ❓┊help
3y ago