© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
FilamentF
Filament•3y ago•
4 replies
Moosh

How to dynamically populate select option label using the Form Builder

Hi,

I am using the Select field of the form builder.

I want to use the city names from my City model to populate the option label. If I have to do it manually it would look like this.

protected function getFormSchema(): array
{
return [
Select::make('city')
->options([
'miami' => 'Miami',
'boston' => 'Boston',
'denver' => 'Denver,
])->searchable(),

];
}

What if I wanted to dynamically pull these city from the database. I assume it would look like this but obviously this does not work

protected function getFormSchema(): array
{
return [
Select::make('city')
->options([
City::all()->pluck('city')
])->searchable(),

];
}
Filament banner
FilamentJoin
A powerful open source UI framework for Laravel • Build and ship admin panels & apps fast with Livewire
20,307Members
Resources

Similar Threads

Was this page helpful?
Recent Announcements

Similar Threads

How to get the select option label using $get?
FilamentFFilament / ❓┊help
3y ago
Modifying the option label in Select
FilamentFFilament / ❓┊help
3y ago
How the get the option label from a select
FilamentFFilament / ❓┊help
2y ago
How to eager load within a select using Form Builder?
FilamentFFilament / ❓┊help
2y ago