*/ public function toArray(Request $request): array { return [ 'id' => $this->id, 'title' => $this->title, 'slug' => $this->slug, 'excerpt' => $this->excerpt, 'body' => $this->body, 'featured_image' => $this->featured_image, 'status' => $this->status, 'published_at' => $this->published_at, 'meta_title' => $this->meta_title, 'meta_description' => $this->meta_description, 'author' => new UserResource($this->whenLoaded('user')), 'category' => new CategoryResource($this->whenLoaded('category')), 'tags' => TagResource::collection($this->whenLoaded('tags')), 'created_at' => $this->created_at, 'updated_at' => $this->updated_at, ]; } }