Change the language of Select Component
I have a form and that form has a Select component that has relationship with department table.
The problem that I faced is that when I change the language in create then select data stays in the same language and doesn't change.
I use Spatie/Translatable plugin.
The component with relationship is:
Department Model:
CreateJob.php
Thank you.
9 Replies
Make the select reactive() ?
Still doesn't work
I’m not sure I totally follow how it’s been implemented but I’m not familiar with that translation plug-in so can’t help much further
It is this one https://filamentphp.com/plugins/spatie-translatable
Filament
Spatie Translatable by Dan Harrin - Plugins - Filament
Filament support for
spatie/laravel-translatable
.Ahh ok, I am not too familiar with that I am afraid, you'll need to wait for dan/awocodes/zeppe to check. They are currently at Laracon
Ok I will wait.
Is that the whole form? Can I see the whole class just to check?
@algorithm7991 @anderson_chaves i'm actually having the exact same issue.. i've made a little progress in that i have the relationship for my case (Event with "hasMany" Categories):
The query being generated is:
which is correct, the issue is that I cannot get this
Select
field to refresh when I change the Locale from the dropdown select box. I can't seem to get this field to update, maybe because of the hasMany
relationship and category_id is not actually in the Events table?
Just FYI, when i manually change the ->relationship('categories', 'name->'.app()->getLocale())
to ->relationship('categories', 'name->de')
I do get the German translation, so hardcoding works, but dynamic is not working, but I think purely because it's not 'dirty' and not getting updated by livewireThis is the whole function for the form: