$this->id, 'title' => $this->title, 'slug' => $this->slug, 'summary' => $this->summary, 'content' => $this->content, 'content_type' => $this->content_type, 'content_type_label' => $this->getContentTypeLabel(), 'featured_image_url' => $this->featured_image_url, 'featured_image_alt' => $this->featured_image_alt, 'author_name' => $this->author_name, 'meta_description' => $this->meta_description, 'meta_keywords' => $this->meta_keywords, 'is_pinned' => $this->is_pinned, 'view_count' => $this->view_count, 'published_at' => $this->published_at?->toIso8601String(), 'categories' => CategoryResource::collection($this->whenLoaded('categories')), 'tags' => $this->whenLoaded('tags', function () { return $this->tags->map(fn ($tag) => [ 'id' => $tag->id, 'name' => $tag->name, 'slug' => $tag->slug, ]); }), 'attachments' => $this->whenLoaded('attachments', function () { return $this->attachments->map(fn ($att) => [ 'id' => $att->id, 'original_filename' => $att->original_filename, 'mime_type' => $att->mime_type, 'file_size' => $att->file_size, 'description' => $att->description, ]); }), ]; } }