*/ public function toArray(Request $request): array { return [ 'id' => $this->id, 'title' => $this->title, 'slug' => $this->slug, 'excerpt' => $this->excerpt, 'content' => $this->content, 'image_url' => $this->image, 'post_type' => $this->post_type, 'status' => $this->status, 'published_at' => $this->published_at?->toISOString(), 'date' => $this->date?->format('Y-m-d'), 'time' => $this->time, 'address' => $this->when($this->isEvent(), $this->address), 'description' => $this->when($this->isEvent(), $this->description), 'link' => $this->when($this->isEvent(), $this->link), 'categories' => CategoryResource::collection($this->whenLoaded('categories')), 'created_at' => $this->created_at->toISOString(), 'updated_at' => $this->updated_at->toISOString(), ]; } }