*/ public static function rules(): array { return ['required', 'string', 'max:49', 'regex:/^[\x21-\x7E]+$/', Password::min(8)->letters()->numbers()]; } /** Akun dicari di sumber login yang aktif (AUTH_WEB_PROVIDER). */ public function find(string $username): ?User { $user = Auth::createUserProvider(config('auth.guards.web.provider'))?->retrieveByCredentials(['username' => trim($username)]); return $user instanceof User ? $user : null; } /** @param string $actor username petugas, atau "artisan" dari terminal */ public function reset(User $account, #[\SensitiveParameter] string $password, string $actor, ?string $ip = null): void { $account->resetPassword($password, $actor, $ip); Log::info('Kata sandi diatur ulang.', [ 'akun' => $account->getAuthIdentifier(), 'username' => $account->username, 'oleh' => $actor, 'ip' => $ip, ]); } }