return [ 'id' => $this->id, 'title' => $this->title, 'slug' => $this->slug, 'instructor' => $this->whenLoaded('instructor', fn() => [ 'name' => $this->instructor->name ]), 'sections' => SectionResource::collection($this->whenLoaded('sections')), 'created_at' => $this->created_at->diffForHumans(), ];
Before diving into the course specifics, it is important to understand why Laravel 11 is a significant upgrade: udemy laravel 11 from basics to advance 2024 better