F
Filamentβ€’10mo ago
Matthew

Select doesnt have dafault value on filters form

Filter::make("filters")
->form([
Select::make('status_id')
->label('Status')
->columnSpan(1)
->options(TicketStatus::all()->pluck('name', 'id'))
->multiple()
->searchable()
->native(false),
Select::make('reporter_user_id')
->label('User')
->columnSpan(1)
->options(User::all()->pluck('name', 'id'))
->default(User::find(1)->name)
->multiple()
->searchable()
->native(false),
])
Filter::make("filters")
->form([
Select::make('status_id')
->label('Status')
->columnSpan(1)
->options(TicketStatus::all()->pluck('name', 'id'))
->multiple()
->searchable()
->native(false),
Select::make('reporter_user_id')
->label('User')
->columnSpan(1)
->options(User::all()->pluck('name', 'id'))
->default(User::find(1)->name)
->multiple()
->searchable()
->native(false),
])
As you can see from the picture, the default value isnt applied to the select form. Is there a reason for that? Thanks
Solution:
try ->default([User::find(1)->name]) because you have multiple()
Jump to solution
2 Replies
Solution
Tieme
Tiemeβ€’10mo ago
try ->default([User::find(1)->name]) because you have multiple()
Matthew
MatthewOPβ€’10mo ago
Thanks. Completely forgot about that πŸ˜…
Want results from more Discord servers?
Add your server