Active domain names owned by the account (lowercase). */ public function ownedForUser(string $publicId): array { return collect() ->merge($this->fetchFromStorefront($publicId)) ->merge($this->fetchFromPlatform($publicId)) ->map(fn ($d) => strtolower(trim((string) $d))) ->filter() ->unique() ->sort() ->values() ->all(); } /** @return list */ private function fetchFromStorefront(string $publicId): array { $key = (string) (config('domains.api_key') ?? ''); if ($key === '') { return []; } try { $res = Http::withToken($key) ->acceptJson() ->timeout(10) ->get(rtrim((string) config('domains.api_url'), '/').'/owned-domains', [ 'user' => $publicId, ]); $res->throw(); return (array) $res->json('data', []); } catch (\Throwable $e) { Log::warning('LadillDomainsClient: storefront owned domains unavailable', [ 'user' => $publicId, 'error' => $e->getMessage(), ]); return []; } } /** @return list */ private function fetchFromPlatform(string $publicId): array { $key = (string) (config('domains.platform_api_key') ?? ''); if ($key === '') { return []; } try { $res = Http::withToken($key) ->acceptJson() ->timeout(10) ->get(rtrim((string) config('domains.platform_api_url'), '/').'/owned-domains', [ 'user' => $publicId, ]); $res->throw(); return (array) $res->json('data', []); } catch (\Throwable $e) { Log::warning('LadillDomainsClient: platform owned domains unavailable', [ 'user' => $publicId, 'error' => $e->getMessage(), ]); return []; } } }