*/ public function toArray(Request $request): array { return [ 'id' => $this->id, 'slug' => $this->slug, 'label' => $this->label, 'desc' => $this->desc, 'image' => $this->image, 'meta_title' => $this->meta_title, 'meta_description' => $this->meta_description, 'courses_count' => $this->whenCounted('courses'), // Mega menu kartında gösterilecek kurslar (menu_order 1-3) 'menu_courses' => $this->whenLoaded('menuCourses', fn () => $this->menuCourses->map(fn ($c) => [ 'title' => $c->title, 'slug' => $c->slug, ]) ), 'created_at' => $this->created_at?->toISOString(), 'updated_at' => $this->updated_at?->toISOString(), ]; } }