public static function getOrderedContent($contents) { $sections = Sections::getPublish(); $array = array(); $position = 0; foreach ($sections as $section) { foreach ($contents as $content) { if ($content->section->id == $section->id) { $array[$position] = $content; $position++; } } } return $array; }
/** * Display a listing of the resource. * * @return Response */ public function getUpdate($id = '') { // if ($id == '') { return Redirect::to($this->route); } else { $course = Courses::find($id); $categories = Categories::getPublish(); $events = Events::getPublish(); $companies = Companies::getPublish(); $sections = Sections::getPublish(); $content = $course->sections; $course->start = date("d-m-Y", strtotime($course->start)); $course->end = date("d-m-Y", strtotime($course->end)); $array = array('course' => $course, 'sections' => $sections, 'categories' => $categories, 'events' => $events, 'companies' => $companies, 'promotioners' => $companies, 'supporters' => $companies); if (!$course) { return Redirect::to($this->route); } else { return View::make("backend.courses.update", $array); } } }