F
Filament13mo ago
rabol

how do I get the active locale to be used in a translatable select

I have a translatable resource and this resource have a belongsTo relationship to another translatable resource Both resources are created with the -S option FaqCategory and Faq ar both translatable When creating a new Faq, I have this:
public static function form(Form $form): Form
{
return $form
->schema([
Forms\Components\TextInput::make('title')
->required(),
Forms\Components\TextInput::make('body')
->required(),
Forms\Components\Select::make('faq_category_id')
->relationship(name: 'category', titleAttribute: 'name->en'),
]);
}
public static function form(Form $form): Form
{
return $form
->schema([
Forms\Components\TextInput::make('title')
->required(),
Forms\Components\TextInput::make('body')
->required(),
Forms\Components\Select::make('faq_category_id')
->relationship(name: 'category', titleAttribute: 'name->en'),
]);
}
It works, but I always get the 'English' name in the select I can see that the trait on the
ManageFaqs
ManageFaqs
has a getActiveTableLocale(), but as it's not a static methodI cannot call that in my resource, so how do I get the active locale
0 Replies
No replies yetBe the first to reply to this messageJoin
Want results from more Discord servers?
Add your server