Files
ladill-hosting/app/Services/Domain/DomainClient.php
T
isaaccladandCursor e251a4cf60
Deploy Ladill Hosting / deploy (push) Failing after 17s
Initial Ladill Hosting app with Gitea deploy pipeline.
Shared web hosting extracted from the platform monolith, with CI deploy
to /var/www/ladill-hosting matching Bird/Domains/Email.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-06-06 16:24:20 +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_HOSTING', ''));
}
/** @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() ?? []);
}
}