Use translatable for relations in select components
- Published: 25 Mar 2024 Updated: 04 May 2024
get translatable attribute in a relationships
when using a relations in a select menu or a filter, and that model is translatable, this is how to get the translatable attribute:
1->getOptionLabelFromRecordUsing(fn (Model $record) => $record->title)
Related Tricks:
Usability: Knowing whether or not the record was saved.
How to Apply Authorization on Create Option Action for Select Field
Sometimes, when we need to test our application locally, we always have to fill forms manually. Let's take the Filament approach and achieve this with more accurate data.
Translating components can often be a repetitive task, Fortunately, there's a neat trick to automate this process, making your components instantly translatable.
Form Builder lets you build dynamic, versioned forms in Filament and attach them to any model. Responses are stored in JSON with zero boilerplate.