Deploy Ladill Events / deploy (push) Successful in 1m23s
Customers can connect their own domain to a events page (storefront/event): add a domain, point an A record (apex + www) to the app server, click Verify — DNS is checked, then Ladill Domains' central SSL service issues + installs the Let's Encrypt cert and calls back to flip it live. The custom domain then serves the mapped page (host resolution on /). Feature-gated: only active when a Domains SSL API key is set, so this deploy is inert until wired. - custom_domains table + CustomDomain model - CustomDomainService (DNS verify, request cert), DomainsSslClient, DnsResolver - settings UI panel, signed SSL callback receiver, host resolution on / - feature tests (DNS verify/fail, signed callback, ownership) Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
55 lines
1.8 KiB
PHP
55 lines
1.8 KiB
PHP
<?php
|
|
|
|
namespace App\Http\Controllers\Events;
|
|
|
|
use App\Http\Controllers\Controller;
|
|
use App\Models\CustomDomain;
|
|
use App\Models\QrCode;
|
|
use App\Services\CustomDomain\CustomDomainService;
|
|
use Illuminate\Http\RedirectResponse;
|
|
use Illuminate\Http\Request;
|
|
|
|
class CustomDomainController extends Controller
|
|
{
|
|
public function __construct(private readonly CustomDomainService $service) {}
|
|
|
|
public function store(Request $request, QrCode $event): RedirectResponse
|
|
{
|
|
$this->authorize('update', $event);
|
|
abort_unless($this->service->enabled(), 404);
|
|
|
|
$data = $request->validate([
|
|
'host' => ['required', 'string', 'max:255', 'regex:/^(?!-)([a-z0-9-]+\.)+[a-z]{2,}$/i'],
|
|
'include_www' => ['nullable', 'boolean'],
|
|
]);
|
|
|
|
$host = strtolower(preg_replace('/^www\./', '', trim($data['host'])));
|
|
|
|
if (CustomDomain::where('host', $host)->exists()) {
|
|
return back()->withErrors(['host' => 'That domain is already connected.']);
|
|
}
|
|
|
|
$this->service->attach($event, $host, (bool) ($data['include_www'] ?? true));
|
|
|
|
return back()->with('success', "Domain added. Point an A record for {$host} (and www) to ".config('customdomain.server_ip').', then click Verify.');
|
|
}
|
|
|
|
public function verify(Request $request, CustomDomain $customDomain): RedirectResponse
|
|
{
|
|
$this->authorize('update', $customDomain->qrCode);
|
|
|
|
[$ok, $message] = $this->service->verifyAndProvision($customDomain);
|
|
|
|
return back()->with($ok ? 'success' : 'error', $message);
|
|
}
|
|
|
|
public function destroy(Request $request, CustomDomain $customDomain): RedirectResponse
|
|
{
|
|
$this->authorize('update', $customDomain->qrCode);
|
|
|
|
$customDomain->delete();
|
|
|
|
return back()->with('success', 'Custom domain removed.');
|
|
}
|
|
}
|