components([ TextInput::make('name') ->label('Nama Lengkap') ->placeholder('John Doe') ->autocomplete(false) ->autofocus() ->required() ->maxLength(100), TextInput::make('email') ->label('Alamat Surel') ->placeholder('johndoe@example.com') ->autocomplete(false) ->required() ->maxLength(254) ->unique('users', 'email') ->email() ->prefixIcon('heroicon-o-envelope') ->aboveContent('Pastikan alamat surel aktif untuk verifikasi akun Anda.'), TextInput::make('username') ->label('Nama Pengguna') ->placeholder('johndoe') ->autocomplete(false) ->required() ->minLength(5) ->maxLength(10) ->regex('/^[a-zA-Z0-9_.-]+$/') ->unique('users', 'username') ->prefixIcon('heroicon-o-at-symbol'), TextInput::make('password') ->label('Kata Sandi') ->password() ->revealable(filament()->arePasswordsRevealable()) ->required() ->rule(Password::default()) ->autocomplete(false) ->dehydrated(fn ($state): bool => filled($state)) ->dehydrateStateUsing(fn ($state): string => Hash::make($state)) ->placeholder('********') ->prefixIcon('heroicon-o-lock-closed'), ]); } protected function handleRegistration(array $data): Model { $user = $this->getUserModel()::create($data); $user->assignRole('Perusahaan'); CheerfulNotification::success( CheerfulNotification::getMessage('Selamat Datang! 👋🎉', 'Pendaftaran Berhasil'), CheerfulNotification::getMessage("Halooo, {$user->name}!, terima kasih sudah bergabung! Akunmu berhasil dibuat. Silakan verifikasi alamat surelmu! 🚀✨", "Selamat datang, {$user->name}. Akun Anda telah berhasil dibuat. Silakan periksa email Anda untuk melakukan verifikasi.") ) ->send(); $this->getUserModel()::superAdmin() ->get() ->each(function ($admin) use ($user): void { $admin->notify(new BroadcastNotification([ 'title' => CheerfulNotification::getMessage('Warga Baru Nih! 👋🎉', 'Pendaftaran Pengguna Baru'), 'body' => CheerfulNotification::getMessage("Halo Admin! {$user->name} baru saja mendaftar. Yuk cek kelengkapannya! 🚀", "Pengguna baru {$user->name} telah mendaftar ke dalam sistem."), 'action' => [ Action::make('view') ->label('Lihat') ->url(PartnerResource::getUrl('view', ['record' => $user->id])), ], ])); }); return $user; } }