components([ TextInput::make('name') ->label('Nome') ->required() ->maxLength(255), TextInput::make('email') ->label('E-mail') ->email() ->required() ->maxLength(255) ->unique(ignoreRecord: true), Select::make('role') ->label('Papel') ->options([ UserRole::Admin->value => UserRole::Admin->label(), UserRole::Assistant->value => UserRole::Assistant->label(), ]) ->required(), Toggle::make('is_active') ->label('Ativo') ->default(true), TextInput::make('password') ->label('Senha') ->password() ->revealable() ->dehydrateStateUsing(fn (?string $state): ?string => filled($state) ? Hash::make($state) : null) ->dehydrated(fn (?string $state): bool => filled($state)) ->required(fn (string $operation): bool => $operation === 'create'), ]); } }