createOptionForm()

when i create resource from createOptionForm getting error in my form i have hidden field Select::make('hospital_id') ->hidden(function () use ($hospitalId) { return $hospitalId !== null; }) ->label(__('Hospital')) ->relationship('hospital', 'name') ->required() ->visible(fn () => Auth::user()->isSuperAdmin()), when i fill this field its fine
No description
1 Reply
Tieme
Tieme7mo ago
simple solution is set required also dynamic
->required(function () use ($hospitalId) {
return $hospitalId !== null;
})
->required(function () use ($hospitalId) {
return $hospitalId !== null;
})
Also, the hidden is only appelyed if you are not logged in as Super Admin
Want results from more Discord servers?
Add your server