*/ public function toArray(Request $request): array { return [ 'id' => $this->id, 'title' => $this->title, 'slug' => $this->slug, 'teaser' => $this->teaser, 'category' => $this->whenLoaded('category', fn () => $this->category ? [ 'name' => $this->category->name, 'slug' => $this->category->slug, ] : null), 'cover_url' => $this->coverUrl('large'), 'thumb_url' => $this->coverUrl('thumb'), 'published_at' => $this->published_at?->toIso8601String(), 'reading_minutes' => $this->reading_minutes, ]; } }