Hide fulfilled pending-setup orders from the customer hosting list.
Deploy Ladill Hosting / deploy (push) Successful in 45s
Deploy Ladill Hosting / deploy (push) Successful in 45s
Sales Centre left Active CustomerHostingOrder rows with pending-setup.local alongside real HostingAccounts, so customers saw two hostings. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -146,6 +146,53 @@ class CustomerHostingOrder extends Model
|
||||
return $query->where('user_id', $userId);
|
||||
}
|
||||
|
||||
/** Orders still awaiting payment, approval, or provisioning — not live accounts. */
|
||||
public function scopeInFlight($query)
|
||||
{
|
||||
return $query->whereIn('status', [
|
||||
self::STATUS_PENDING_PAYMENT,
|
||||
self::STATUS_PENDING_APPROVAL,
|
||||
self::STATUS_APPROVED,
|
||||
self::STATUS_PROVISIONING,
|
||||
]);
|
||||
}
|
||||
|
||||
public static function isPlaceholderDomainName(?string $domain): bool
|
||||
{
|
||||
$domain = strtolower(trim((string) $domain));
|
||||
|
||||
return $domain === '' || $domain === 'pending-setup.local' || str_ends_with($domain, '.ladill.com');
|
||||
}
|
||||
|
||||
/**
|
||||
* Label for UI lists — never surface pending-setup.local when a real
|
||||
* hosting account / domain is available.
|
||||
*/
|
||||
public function displayDomainLabel(): string
|
||||
{
|
||||
if ($this->relationLoaded('hostingAccount') && $this->hostingAccount) {
|
||||
$account = $this->hostingAccount;
|
||||
if (! $account->relationLoaded('sites')) {
|
||||
$account->load('sites');
|
||||
}
|
||||
|
||||
$label = $account->linkedDomainLabel();
|
||||
if (filled($label) && ! static::isPlaceholderDomainName($label)) {
|
||||
return $label;
|
||||
}
|
||||
}
|
||||
|
||||
if (! static::isPlaceholderDomainName($this->domain_name)) {
|
||||
return (string) $this->domain_name;
|
||||
}
|
||||
|
||||
if (filled($this->server_ip)) {
|
||||
return (string) $this->server_ip;
|
||||
}
|
||||
|
||||
return 'Domain pending';
|
||||
}
|
||||
|
||||
public function isPendingApproval(): bool
|
||||
{
|
||||
return $this->status === self::STATUS_PENDING_APPROVAL;
|
||||
|
||||
Reference in New Issue
Block a user