Files
ladill-servers/app/Services/Domain/DomainClient.php
T
isaaccladandCursor b6c8ac343f Extract Ladill Servers as standalone app at servers.ladill.com.
VPS and dedicated server ordering, managed panels, SSO, billing, and launcher integration — forked from hosting infrastructure with server-focused routes and dashboard.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-06-06 19:18:30 +00:00

37 lines
932 B
PHP

<?php
namespace App\Services\Domain;
use Illuminate\Support\Facades\Http;
/** Optional stub — fetch user domains from the platform Domains API. */
class DomainClient
{
private function base(): string
{
return rtrim((string) config('domain.api_url', env('DOMAIN_API_URL', '')), '/');
}
private function token(): string
{
return (string) config('domain.api_key', env('DOMAIN_API_KEY_SERVERS', ''));
}
/** @return list<array<string, mixed>> */
public function listForUser(string $publicId): array
{
if ($this->base() === '' || $this->token() === '') {
return [];
}
$res = Http::withToken($this->token())->acceptJson()->timeout(10)
->get($this->base().'/domains', ['user' => $publicId]);
if ($res->failed()) {
return [];
}
return (array) ($res->json('data') ?? $res->json() ?? []);
}
}