'integer', 'certificate' => 'encrypted', 'pk' => 'encrypted', 'ca' => 'encrypted', 'expires_at' => 'datetime', 'domains' => 'array', 'log_id' => 'integer', 'is_active' => 'boolean', ]; public static array $statusColors = [ SslStatus::CREATED => 'success', SslStatus::CREATING => 'warning', SslStatus::DELETING => 'warning', SslStatus::FAILED => 'danger', ]; public function site(): BelongsTo { return $this->belongsTo(Site::class); } public function validateSetup(string $result): bool { if (! Str::contains($result, 'Successfully received certificate')) { return false; } if ($this->type == 'letsencrypt') { $this->certificate_path = '/etc/letsencrypt/live/'.$this->id.'/fullchain.pem'; $this->pk_path = '/etc/letsencrypt/live/'.$this->id.'/privkey.pem'; $this->save(); } return true; } public function getDomains(): array { if (! empty($this->domains) && is_array($this->domains)) { return $this->domains; } $this->domains = [$this->site->domain]; $this->save(); return $this->domains; } public function log(): BelongsTo { return $this->belongsTo(ServerLog::class); } }