F
Filament5mo ago
danzzz

Use Spatie Translate language in Tables / Forms

I use spatie translate and can switch the language in my resources. I want to use the current language (not global language of laravel) in the table or forms. i mean the value of the language switcher. is that possible?
Solution:
In case some needs it, solved it with this code: `Tables\Columns\TextColumn::make('parent.name') ->state(function($livewire, QuestionCategory $questionCategory) { if(isset($questionCategory->parent->name))...
Jump to solution
1 Reply
Solution
danzzz
danzzz5mo ago
In case some needs it, solved it with this code: Tables\Columns\TextColumn::make('parent.name') ->state(function($livewire, QuestionCategory $questionCategory) { if(isset($questionCategory->parent->name)) return $questionCategory->parent->getTranslation('name',$livewire->activeLocale); return ''; }) ->label('Kategorie') ->searchable(),