components([ Section::make('Benutzerkonto') ->icon('lucide-user') ->schema([ Select::make('gender') ->prefixIcon('phosphor-gender-neuter') ->label('Geschlecht') ->options([ 'Herr' => 'Herr', 'Frau' => 'Frau', 'Non-binary' => 'Non-binary', ]) ->required(), TextInput::make('name') ->prefixIcon('phosphor-user') ->required(), TextInput::make('email')->email() ->required() ->prefixIcon('phosphor-envelope') ->label('E-Mail'), TextInput::make('password') ->prefixIcon('phosphor-lock') ->label('Passwort') ->password() // Masks the input ->required() ->revealable() ->rule(Password::min(8)->mixedCase()->numbers()->symbols()->uncompromised()) // Enforces strong password policies ->dehydrateStateUsing(fn ($state) => bcrypt($state)) // Hashes the password before saving ->label('Password'), TextInput::make('password_confirmation') ->prefixIcon('phosphor-lock') ->password() // Masks the input ->required() ->same('password') // Validates that this matches the 'password' field ->label('Passwort Bestätigen'), Checkbox::make('agb_akzeptiert') ->default(false) ->label('Allgemeinen Geschäftsbedinnungen akzeptieren') ->accepted() ->validationMessages([ 'accepted' => 'Das Akzeptieren der Allgemeinen Geschäftsbedingungen ist erforderlich.', ]), Select::make('roles') ->label('Rolle') ->prefixIcon('phosphor-gear') ->aboveContent('Nur für SuperAdmin sichtbare') ->visible(fn () => auth()->user()->hasRole('super_admin')) ->relationship('roles', 'name') ->multiple() ->preload() ->searchable(), ]), ])->columns(1); } }