rhukster
rhukster
FFilament
Created by Algorithm on 7/20/2023 in #❓┊help
Change the language of Select Component
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 livewire
11 replies
FFilament
Created by Algorithm on 7/20/2023 in #❓┊help
Change the language of Select Component
@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):
Forms\Components\Select::make('category_id')
->multiple()
->columnSpanFull()
->relationship('categories', 'name->'.app()->getLocale())
->preload()
->required(),
Forms\Components\Select::make('category_id')
->multiple()
->columnSpanFull()
->relationship('categories', 'name->'.app()->getLocale())
->preload()
->required(),
The query being generated is:
select
json_unquote(json_extract(`name`, '$."en"')) as `name->en`,
`id`
from
`categories`
order by
json_unquote(json_extract(`name`, '$."en"')) asc
select
json_unquote(json_extract(`name`, '$."en"')) as `name->en`,
`id`
from
`categories`
order by
json_unquote(json_extract(`name`, '$."en"')) asc
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?
11 replies