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:Jump to 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))...
1 Reply
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))
return $questionCategory->parent->getTranslation('name',$livewire->activeLocale);
return '';
})
->label('Kategorie')
->searchable(),