$this->id, 'post_category_id' => $this->post_category_id, 'title' => $this->title, 'slug' => $this->slug, 'excerpt' => $this->excerpt, 'content' => $this->content, 'thumbnail' => $this->thumbnail, 'status' => $this->status, 'is_featured' => (bool) $this->is_featured, 'view_count' => (int) $this->view_count, 'reading_time' => $this->reading_time, 'meta_title' => $this->meta_title, 'meta_description' => $this->meta_description, 'published_at' => $this->published_at?->toISOString(), 'created_at' => $this->created_at?->toISOString(), 'updated_at' => $this->updated_at?->toISOString(), 'category' => $this->whenLoaded('category', fn () => new PostCategoryResource($this->category)), 'related_posts' => $this->when(isset($this->related_posts), fn () => $this->related_posts->map(fn ($post) => [ 'id' => $post->id, 'post_category_id' => $post->post_category_id, 'title' => $post->title, 'slug' => $post->slug, 'excerpt' => $post->excerpt, 'thumbnail' => $post->thumbnail, 'status' => $post->status, 'is_featured' => (bool) $post->is_featured, 'view_count' => (int) $post->view_count, 'reading_time' => $post->reading_time, 'published_at' => $post->published_at?->toISOString(), 'category' => $post->relationLoaded('category') && $post->category ? new PostCategoryResource($post->category) : null, ])->values()), ]; } }