Search by translated name

i have a users table. it has a relationship with roles table. roles table: id, name 1, player ... so im in the modal create action to add a new user to that table. there, im showing a searchable select to choose multiple roles for the user. the thing is that im translating the name of the roles, but once i start searching, i get the names in english, and not translated is there a way to search by translated names instead of not translated names this is the select:
Select::make('roles')
->multiple()
->relationship('roles', 'name')
->options(function () {
return Role::query()
->when(! auth()->user()->hasRole('Superadmin'), function ($q) {
$q->where('name', '!=', 'Superadmin');
})
->pluck('name', 'id')
->map(function ($caseName) {
return __($caseName);
})
->toArray()
;
})
->label(__('Roles'))
,
Select::make('roles')
->multiple()
->relationship('roles', 'name')
->options(function () {
return Role::query()
->when(! auth()->user()->hasRole('Superadmin'), function ($q) {
$q->where('name', '!=', 'Superadmin');
})
->pluck('name', 'id')
->map(function ($caseName) {
return __($caseName);
})
->toArray()
;
})
->label(__('Roles'))
,
1 Reply
ericmp #2
ericmp #211mo ago
so when i first clic on the select, i see the roles translated, but once i start the search, it just removes the translations and returns the roles as they are, no translated