Hide field in form

Hi, I am creating different resources, depending on the type of role, but, I want it to NOT SHOW, just send a default role. This is my code: Select::make('roles') ->relationship('roles', 'name') ->default(Role::where('name', 'student')->first()->id) ->preload(),
No description
8 Replies
PabloZagni
PabloZagni7mo ago
use Filament\Forms\Get; use Filament\Forms\Components\Checkbox; use Filament\Forms\Components\TextInput; Checkbox::make('is_company') ->live() TextInput::make('company_name') ->hidden(fn (Get $get): bool => ! $get('is_company'))
aacarrion4
aacarrion4OP7mo ago
Sorry, I can't find a way to hide it, I checked the documentation, but I didn't succeed. Do you have any other ideas?
aacarrion4
aacarrion4OP7mo ago
I have placed this, but, if I hide the select, it doesn't matter, the role is not saved.
No description
No description
LeandroFerreira
LeandroFerreira7mo ago
Would you like to remove the select and save a default role?
aacarrion4
aacarrion4OP7mo ago
Yes, I just want the default Student role to be saved. But, I don't want it to be displayed on the form. I want the user to be created automatically with the student role.
Want results from more Discord servers?
Add your server