logo light

Use translatable for relations in select components

Image Description
By: Lara Zeus
  • Published: 25 Mar 2024 Updated: 04 May 2024

get translatable attribute in a relationships

Use translatable for relations in select components

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)

Back to Tricks