Do hidden fields get processed?

Hi guys - I have a "user_id" field in a form. I want this value to be set to the current user, and the field should be hidden from view. Only admins should be able to see and edit this field. If I hide the field from non-admins, will the default still be set (it's a required field)? Forms\Components\Select::make('user_id') ->relationship('user', 'name') ->searchable() ->preload() ->placeholder('Select user') ->required(),
Solution:
Filament
Creating records - Resources - Admin Panel - Filament
The elegant TALL stack admin panel for Laravel artisans.
Jump to solution
4 Replies
LeandroFerreira
something like this?
->visible(auth()->user()->is_admin)
->visible(auth()->user()->is_admin)
Scott
ScottOP2y ago
will it use the default value if its hidden? ->default(auth()->user()->id)
Solution
LeandroFerreira
Filament
Creating records - Resources - Admin Panel - Filament
The elegant TALL stack admin panel for Laravel artisans.
Scott
ScottOP2y ago
ah, thank you

Did you find this page helpful?