'array', 'webhook_events_filter' => 'array', 'started_at' => 'datetime', 'completed_at' => 'datetime', 'webhook_next_retry_at' => 'datetime' ]; public function getRouteKeyName() { return 'uuid'; } public function buildStatusResponse(): array { $response = [ 'uuid' => $this->uuid, 'status' => $this->status, 'url' => $this->url, 'created_at' => $this->created_at->toISOString() ]; if ($this->started_at) { $response['started_at'] = $this->started_at->toISOString(); } if ($this->completed_at) { $response['completed_at'] = $this->completed_at->toISOString(); } if ($this->status === 'completed' && $this->file_path) { if ($this->type === 'crawl') { $response['result'] = [ 'html' => [ 'url' => url("/api/crawl/{$this->uuid}.html"), 'raw' => Storage::get($this->file_path) ] ]; } elseif ($this->type === 'shot') { $imageData = Storage::get($this->file_path); $response['result'] = [ 'image' => [ 'url' => url("/api/shot/{$this->uuid}.webp"), 'raw' => base64_encode($imageData), ], 'mime_type' => 'image/webp', 'format' => 'webp', 'width' => $this->parameters['viewport_width'] ?? 1920, 'height' => $this->parameters['viewport_height'] ?? 1080, 'size' => strlen($imageData) ]; } } if ($this->status === 'failed' && $this->error_message) { $response['error'] = $this->error_message; } return $response; } }