Select realtionship with translation

Select::make('course_id')
->label(__('Course'))
->relationship('course', 'name')
Select::make('course_id')
->label(__('Course'))
->relationship('course', 'name')
the options is not casted
No description
Solution:
thanks , this should work however I solved it using
->getOptionLabelFromRecordUsing(fn ($record) => $record->name)
->getOptionLabelFromRecordUsing(fn ($record) => $record->name)
...
Jump to solution
4 Replies
SLy
SLy14mo ago
Try ->relationship('course', 'name->' . app()->getLocale())
Solution
Mohamed Melouk
Mohamed Melouk14mo ago
thanks , this should work however I solved it using
->getOptionLabelFromRecordUsing(fn ($record) => $record->name)
->getOptionLabelFromRecordUsing(fn ($record) => $record->name)
SLy
SLy14mo ago
Yes, that too, meanwhile I have an issue with multiselect not working with translatable values, I get Uncaught (in promise) Could not find Livewire component in DOM tree when switching language and values are not translated, did you happen to have this situation working?
Mohamed Melouk
Mohamed MeloukOP14mo ago
yeah I got it I removed localswither and used https://filamentphp.com/plugins/language-switch it's not the best solution but it's the only I found
Filament
Language Switch by Bezhan Salleh - Plugins - Filament
Zero config Language Switch(Changer/Localizer) plugin for Filamentphp Admin
Want results from more Discord servers?
Add your server