components([ Section::make('Informasi Profil 👤') ->description('Kelola detail profil Anda seperti nama, alamat surel, dan nama pengguna.') ->icon('heroicon-m-user-circle') ->schema([ TextInput::make('name') ->label('Nama Lengkap') ->placeholder('Masukkan nama lengkap Anda') ->required() ->maxLength(100) ->prefixIcon('heroicon-m-user'), Grid::make(2) ->schema([ TextInput::make('email') ->label('Alamat Surel') ->placeholder('contoh@email.com') ->autocomplete(false) ->required() ->maxLength(254) ->unique(ignoreRecord: true) ->email() ->prefixIcon('heroicon-m-envelope') ->live(), TextInput::make('username') ->label('Nama Pengguna') ->placeholder('nama_pengguna') ->autocomplete(false) ->required() ->minLength(5) ->maxLength(20) ->regex('/^[a-zA-Z0-9_.-]+$/') ->unique(ignoreRecord: true) ->prefixIcon('heroicon-m-at-symbol'), ]), ]), Section::make('Keamanan Akun 🔒') ->description('Pastikan akun Anda menggunakan kata sandi yang panjang dan aman.') ->icon('heroicon-m-finger-print') ->schema([ Grid::make(2) ->schema([ TextInput::make('password') ->label(__('filament-panels::auth/pages/register.form.password.label')) ->placeholder('********') ->password() ->revealable(filament()->arePasswordsRevealable()) ->required(fn (Get $get) => filled($get('password')) || filled($get('passwordConfirmation'))) ->rule(Password::default()) ->showAllValidationMessages() ->dehydrated(fn ($state) => filled($state)) ->dehydrateStateUsing(fn ($state) => Hash::make($state)) ->same('passwordConfirmation') ->validationAttribute(__('filament-panels::auth/pages/register.form.password.validation_attribute')) ->prefixIcon('heroicon-m-lock-closed'), TextInput::make('passwordConfirmation') ->label(__('filament-panels::auth/pages/register.form.password_confirmation.label')) ->placeholder('********') ->password() ->revealable(filament()->arePasswordsRevealable()) ->required(fn (Get $get) => filled($get('password')) || filled($get('passwordConfirmation'))) ->dehydrated(false) ->prefixIcon('heroicon-m-shield-check'), ]), ]), ]); } protected function handleRecordUpdate(Model $record, array $data): Model { $passwordChanged = filled($data['password'] ?? null); $record->update($data); CheerfulNotification::success( 'Profil Berhasil Diperbarui ✅', 'Data profil Anda telah berhasil disimpan dan diperbarui di dalam sistem.' )->send(); if ($passwordChanged) { auth()->logout(); } return $record; } protected function getSavedNotification(): ?Notification { return null; } }