© 2026 Hedgehog Software, LLC

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

Forms\Components\Select: relationship with json column list?

how can I return a parsed list using a relationship when the db field is a json, (get only the "title, or parse by locale)?
  Forms\Components\Select::make('related_dishes')
                                    ->preload()
                                    ->multiple()
                                    ->label('Related Dishes')
                                    ->relationship('relatedDishes', 'title') 
                                    ->placeholder('Select a Related Dish'),
  Forms\Components\Select::make('related_dishes')
                                    ->preload()
                                    ->multiple()
                                    ->label('Related Dishes')
                                    ->relationship('relatedDishes', 'title') 
                                    ->placeholder('Select a Related Dish'),
,
Screenshot_2023-12-10_at_17.34.48.png
Solution
try using
->getOptionLabelFromRecordUsing(fn (Model $record) => "{$record->title}")
->getOptionLabelFromRecordUsing(fn (Model $record) => "{$record->title}")
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

Similar Threads

Was this page helpful?
Recent Announcements

Similar Threads

\Forms\Components\Select
FilamentFFilament / ❓┊help
5mo ago
Forms\Components\Select with relationship loads all records from DB
FilamentFFilament / ❓┊help
3y ago
Run Forms\Components\Select::..->options(..) after another Forms\Components\Select filled
FilamentFFilament / ❓┊help
3y ago
Filament\Forms\Components\Select::isOptionDisabled():
FilamentFFilament / ❓┊help
3y ago