Deploy Ladill Hosting / deploy (push) Failing after 17s
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>
125 lines
3.0 KiB
PHP
125 lines
3.0 KiB
PHP
<?php
|
|
|
|
namespace App\Models;
|
|
|
|
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
|
use Illuminate\Database\Eloquent\Model;
|
|
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
|
use Illuminate\Database\Eloquent\Relations\HasMany;
|
|
|
|
class Domain extends Model
|
|
{
|
|
use HasFactory;
|
|
|
|
public const MODE_NS_AUTO = 'ns_auto';
|
|
public const MODE_MANUAL_DNS = 'manual_dns';
|
|
public const MODE_RESELLER_AUTO = 'reseller_auto';
|
|
|
|
public const STATE_PENDING_NS = 'pending_ns';
|
|
public const STATE_VERIFYING_NS = 'verifying_ns';
|
|
public const STATE_CONNECTED = 'connected';
|
|
public const STATE_MAIL_READY = 'mail_ready';
|
|
public const STATE_ACTIVE = 'active';
|
|
public const STATE_FAILED = 'failed';
|
|
|
|
protected $fillable = [
|
|
'user_id',
|
|
'website_id',
|
|
'hosting_account_id',
|
|
'email_domain_id',
|
|
'email_server_id',
|
|
'host',
|
|
'type',
|
|
'source',
|
|
'onboarding_mode',
|
|
'verification_token',
|
|
'verified_at',
|
|
'status',
|
|
'onboarding_state',
|
|
'dns_mode',
|
|
'ns_expected',
|
|
'ns_observed',
|
|
'ns_checked_at',
|
|
'connected_at',
|
|
'mail_ready_at',
|
|
'active_at',
|
|
'manual_dns_verified_at',
|
|
'verification_meta',
|
|
'ssl_status',
|
|
'ssl_provisioned_at',
|
|
'ssl_expires_at',
|
|
'registrar',
|
|
'registrar_order_id',
|
|
];
|
|
|
|
protected $casts = [
|
|
'verified_at' => 'datetime',
|
|
'ns_expected' => 'array',
|
|
'ns_observed' => 'array',
|
|
'ns_checked_at' => 'datetime',
|
|
'connected_at' => 'datetime',
|
|
'mail_ready_at' => 'datetime',
|
|
'active_at' => 'datetime',
|
|
'manual_dns_verified_at' => 'datetime',
|
|
'verification_meta' => 'array',
|
|
'ssl_provisioned_at' => 'datetime',
|
|
'ssl_expires_at' => 'datetime',
|
|
];
|
|
|
|
public function user(): BelongsTo
|
|
{
|
|
return $this->belongsTo(User::class);
|
|
}
|
|
|
|
public function website(): BelongsTo
|
|
{
|
|
return $this->belongsTo(Website::class);
|
|
}
|
|
|
|
public function hostingAccount(): BelongsTo
|
|
{
|
|
return $this->belongsTo(HostingAccount::class);
|
|
}
|
|
|
|
public function emailDomain(): BelongsTo
|
|
{
|
|
return $this->belongsTo(EmailDomain::class);
|
|
}
|
|
|
|
public function emailServer(): BelongsTo
|
|
{
|
|
return $this->belongsTo(EmailServer::class);
|
|
}
|
|
|
|
public function dnsRecords(): HasMany
|
|
{
|
|
return $this->hasMany(DomainDnsRecord::class);
|
|
}
|
|
|
|
public function dkimKeys(): HasMany
|
|
{
|
|
return $this->hasMany(DomainDkimKey::class);
|
|
}
|
|
|
|
public function nsChecks(): HasMany
|
|
{
|
|
return $this->hasMany(DomainNsCheck::class);
|
|
}
|
|
|
|
public function mailboxes(): HasMany
|
|
{
|
|
return $this->hasMany(Mailbox::class);
|
|
}
|
|
|
|
public function hostedSites(): HasMany
|
|
{
|
|
return $this->hasMany(HostedSite::class);
|
|
}
|
|
|
|
public function isActiveForMail(): bool
|
|
{
|
|
return (string) $this->status === 'verified'
|
|
&& (string) $this->onboarding_state === self::STATE_ACTIVE;
|
|
}
|
|
}
|