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>
This commit is contained in:
@@ -0,0 +1,36 @@
|
||||
<?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() ?? []);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user