F
Filament17mo ago
Scott

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
LeandroFerreira17mo ago
something like this?
->visible(auth()->user()->is_admin)
->visible(auth()->user()->is_admin)
Scott
ScottOP17mo ago
will it use the default value if its hidden? ->default(auth()->user()->id)
Solution
LeandroFerreira
LeandroFerreira17mo ago
Filament
Creating records - Resources - Admin Panel - Filament
The elegant TALL stack admin panel for Laravel artisans.
Scott
ScottOP17mo ago
ah, thank you
Want results from more Discord servers?
Add your server