'integer', 'site_id' => 'integer', ]; public static function boot(): void { parent::boot(); static::deleting(function (ServerLog $log) { if (Storage::disk($log->disk)->exists($log->name)) { Storage::disk($log->disk)->delete($log->name); } }); } public function getRouteKey(): string { return 'log'; } public function server(): BelongsTo { return $this->belongsTo(Server::class); } public function site(): BelongsTo { return $this->belongsTo(Site::class); } public function write($buf): void { if (Str::contains($buf, 'VITO_SSH_ERROR')) { $buf = str_replace('VITO_SSH_ERROR', '', $buf); } if (Storage::disk($this->disk)->exists($this->name)) { Storage::disk($this->disk)->append($this->name, $buf); } else { Storage::disk($this->disk)->put($this->name, $buf); } } public function getContentAttribute(): ?string { if (Storage::disk($this->disk)->exists($this->name)) { return Storage::disk($this->disk)->get($this->name); } return ''; } }