*/ public function toArray(Request $request): array { return [ 'id' => $this->id, // What a record stores — `featured_image` on a page — and so the one // field a caller has to keep. 'path' => $this->path, 'url' => $this->url(), 'mime' => $this->mime, 'size' => $this->size, 'width' => $this->width, 'height' => $this->height, // False until the queue has derived the smaller versions and the // placeholder. The image serves either way. 'processed' => $this->isProcessed(), 'error' => $this->error, // Only in the library, where it decides whether a file may go. 'referenced' => $this->when( array_key_exists('referenced', $this->resource->getAttributes()), fn () => (bool) $this->resource->getAttribute('referenced'), ), 'created_at' => $this->created_at?->toIso8601String(), ]; } }