/** * Listing the Course for an Age Group * @param int $id * @return App\Course */ public function listCourses($id) { $ageGroup = AgeGroup::with(['courses' => function ($query) { $query->with('days'); }])->whereId($id)->get(); return $ageGroup; }