Files
ladill-hosting/app/Support/helpers.php
T
isaaccladandCursor 537e34cbd7
Deploy Ladill Hosting / deploy (push) Successful in 51s
Wire Ladill domain picker and purchase modal into hosting flows.
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>
2026-06-19 18:01:23 +00:00

57 lines
1.7 KiB
PHP

<?php
use App\Models\User;
if (! function_exists('ladill_account')) {
/**
* The account the current request acts within — the owner User. Defaults to
* the authenticated user; a team member who switched accounts gets the owner.
* Set by the SetActingAccount middleware.
*/
function ladill_account(): ?User
{
$request = request();
return $request->attributes->get('actingAccount') ?? $request->user();
}
}
if (! function_exists('ladill_domains_url')) {
function ladill_domains_url(string $path = ''): string
{
return 'https://'.config('app.domains_domain').($path !== '' ? '/'.ltrim($path, '/') : '');
}
}
if (! function_exists('ladill_domains_embed_url')) {
function ladill_domains_embed_url(string $path = '/embed/find'): string
{
$url = ladill_domains_url($path);
$origin = rtrim((string) config('app.url'), '/');
$separator = str_contains($url, '?') ? '&' : '?';
return $url.$separator.'parent_origin='.urlencode($origin);
}
}
if (! function_exists('ladill_home_url')) {
function ladill_home_url(string $path = ''): string
{
return 'https://home.'.config('app.platform_domain').($path !== '' ? '/'.ltrim($path, '/') : '');
}
}
if (! function_exists('ladill_account_url')) {
function ladill_account_url(string $path = ''): string
{
return 'https://'.config('app.account_domain').($path !== '' ? '/'.ltrim($path, '/') : '');
}
}
if (! function_exists('ladill_servers_url')) {
function ladill_servers_url(string $path = ''): string
{
return 'https://'.config('app.servers_domain').($path !== '' ? '/'.ltrim($path, '/') : '');
}
}