'date', 'auto_renew' => 'boolean', 'last_checked_at' => 'datetime', ]; } public function organization() { return $this->belongsTo(Organization::class); } public function sslCertificates() { return $this->hasMany(SslCertificate::class); } public function tld(): ?string { $parts = explode('.', $this->name); return count($parts) > 1 ? '.'.end($parts) : null; } public function expiresInDays(): ?int { return $this->expires_at ? now()->startOfDay()->diffInDays($this->expires_at, false) : null; } public function expiryStatus(): string { $days = $this->expiresInDays(); return match (true) { $days === null => 'unknown', $days < 0 => 'expired', $days <= 30 => 'soon', default => 'ok', }; } }