Why are the roles not being translated?
im not using admin panel, only installed forms & tables packages
Select::make('roles')
->multiple()
->relationship('roles', 'name', function ($query) {
$query->when(! auth()->user()->hasRole('Superadmin'), function ($q) {
$q->where('name', '!=', 'Superadmin');
});
})
->options(function (User $record) {
$roles = Role::query()
->when(! auth()->user()->hasRole('Superadmin'), function ($q) {
$q->where('name', '!=', 'Superadmin');
})
->whereNotIn('id', $record->roles()->pluck('roles.id'))
->pluck('name', 'id')
->map(function ($caseName) {
return __($caseName);
})
->toArray()
;
info($roles);
return $roles;
})
->label(__('Roles'))
,
Select::make('roles')
->multiple()
->relationship('roles', 'name', function ($query) {
$query->when(! auth()->user()->hasRole('Superadmin'), function ($q) {
$q->where('name', '!=', 'Superadmin');
});
})
->options(function (User $record) {
$roles = Role::query()
->when(! auth()->user()->hasRole('Superadmin'), function ($q) {
$q->where('name', '!=', 'Superadmin');
})
->whereNotIn('id', $record->roles()->pluck('roles.id'))
->pluck('name', 'id')
->map(function ($caseName) {
return __($caseName);
})
->toArray()
;
info($roles);
return $roles;
})
->label(__('Roles'))
,
1 Reply
the problem is the whereNotIn i think
still testing it, but seems the issue