public static function getAllSections() { //get a list of all sections. $sections = Section::paginate(5); $schools = array(); $i = 0; if ($sections) { foreach ($sections as $section) { $school = School::getSchoolBySection($section); $section->setSchoolName($school->name); /* $section->attribute['schoolId'] = $school->id; $section->attribute['schoolName'] = $school->name;*/ /* $section[$i]['schoolId'] = $school->id; $section[$i]['schoolName'] = $school->name; $i++;*/ } } return $sections; }