Wire Ladill domain picker and purchase modal into hosting flows.
Deploy Ladill Hosting / deploy (push) Successful in 51s
Deploy Ladill Hosting / deploy (push) Successful in 51s
Use the Domains API for owned domains across panel, account, and order forms, with an embedded iframe purchase modal instead of redirecting to domains.ladill.com. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -1116,6 +1116,18 @@ class HostingPanelController extends Controller
|
||||
$onboardingMode = $isOwnedDomain
|
||||
? Domain::MODE_NS_AUTO
|
||||
: ($validated['onboarding_mode'] ?? Domain::MODE_NS_AUTO);
|
||||
|
||||
if ($isOwnedDomain) {
|
||||
$owned = $this->availableHostingDomainsForUser($request->user()->id, $account);
|
||||
if (! $owned->contains($domainHost)) {
|
||||
if ($request->wantsJson()) {
|
||||
return response()->json(['message' => 'That domain is not in your Ladill account.'], 422);
|
||||
}
|
||||
|
||||
return back()->with('error', 'That domain is not in your Ladill account.');
|
||||
}
|
||||
}
|
||||
|
||||
$serverIp = $account->node?->ip_address ?? '161.97.138.149';
|
||||
$docRoot = ! empty($validated['document_root'])
|
||||
? "/home/{$account->username}/" . ltrim($validated['document_root'], '/')
|
||||
@@ -1297,35 +1309,13 @@ class HostingPanelController extends Controller
|
||||
->filter()
|
||||
->all();
|
||||
|
||||
$domainRegistryHosts = Domain::where('user_id', $userId)->pluck('host');
|
||||
$user = \App\Models\User::query()->find($userId);
|
||||
$owned = $user
|
||||
? app(\App\Services\Domains\LadillDomainsClient::class)->ownedForUser((string) $user->public_id)
|
||||
: [];
|
||||
|
||||
$registeredDomains = RcServiceOrder::where('user_id', $userId)
|
||||
->whereIn('order_type', [RcServiceOrder::TYPE_DOMAIN_REGISTRATION, RcServiceOrder::TYPE_DOMAIN_TRANSFER])
|
||||
->where('status', RcServiceOrder::STATUS_ACTIVE)
|
||||
->whereNotNull('domain_name')
|
||||
->pluck('domain_name');
|
||||
|
||||
$customerHostingDomains = CustomerHostingOrder::where('user_id', $userId)
|
||||
->whereNotIn('status', [
|
||||
CustomerHostingOrder::STATUS_PENDING_PAYMENT,
|
||||
CustomerHostingOrder::STATUS_CANCELLED,
|
||||
CustomerHostingOrder::STATUS_FAILED,
|
||||
])
|
||||
->whereNotNull('domain_name')
|
||||
->pluck('domain_name');
|
||||
|
||||
$hostingAccountDomains = HostingAccount::where('user_id', $userId)
|
||||
->whereNotNull('primary_domain')
|
||||
->pluck('primary_domain');
|
||||
|
||||
return $domainRegistryHosts
|
||||
->merge($registeredDomains)
|
||||
->merge($customerHostingDomains)
|
||||
->merge($hostingAccountDomains)
|
||||
->map(fn ($d) => strtolower(trim((string) $d)))
|
||||
->filter(fn ($d) => (bool) preg_match('/^(?=.{1,253}$)(?!-)(?:[a-z0-9-]{1,63}\.)+[a-z]{2,63}$/', $d))
|
||||
return collect($owned)
|
||||
->reject(fn ($d) => in_array($d, $linkedDomains, true))
|
||||
->unique()
|
||||
->sort()
|
||||
->values();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user