F
Filament2mo ago
Akimbo

`->in()` validation doesn't seem to work with Select

From what I can tell, the ->in() validation doesn't work with select, unless there are "changes." So if you open a form and the select input already has an option, this will mean there are no changes and in() will fail. You have to reselect your option by clicking a different one, then the original again. This seems to defeat the purpose of in() validation
return $form
->options(function (User $user) use ($can_manage_all_users, $limited_roles, $all_roles) {
if (!$can_manage_all_users) {
return $limited_roles->pluck('name', 'id');
}
return $all_roles->pluck('name', 'id');
})
->in($can_manage_all_users ? $all_roles->pluck('id') : $limited_roles->pluck('id')) // this will not work
return $form
->options(function (User $user) use ($can_manage_all_users, $limited_roles, $all_roles) {
if (!$can_manage_all_users) {
return $limited_roles->pluck('name', 'id');
}
return $all_roles->pluck('name', 'id');
})
->in($can_manage_all_users ? $all_roles->pluck('id') : $limited_roles->pluck('id')) // this will not work
0 Replies
No replies yetBe the first to reply to this messageJoin

Did you find this page helpful?