public static function getCourseContent($id, $course, $idContent) { $contents = self::getOrderedContent($course->coursesections); // dd($contents); $array = array('course' => $course, 'contents' => $contents); if ($idContent != '') { $array['section'] = CoursesSection::find($idContent); switch ($array['section']->section->type) { case 'section': return View::make('frontend.courses.content')->with($array); break; case 'teachers': $array['teachers'] = $course->teachers; return View::make('frontend.courses.teachers')->with($array); break; case 'promotioners': $array['promotioners'] = $course->promotioners; return View::make('frontend.courses.promotioners')->with($array); break; case 'helpers': $array['helpers'] = $course->helpers; return View::make('frontend.courses.helpers')->with($array); break; case 'inscriptions': return View::make('frontend.courses.inscription')->with($array); break; case 'works': return View::make('frontend.courses.works')->with($array); break; case 'supporters': $array['supporters'] = $course->supporters; return View::make('frontend.courses.supporters')->with($array); break; default: return View::make('frontend.courses.content')->with($array); break; } } else { $section = Sections::findByPosition(1); $array['section'] = $contents[0]; return View::make('frontend.courses.content')->with($array); } }
public function getDelete($idCourse, $idContent = '') { if ($idContent == '') { return Redirect::to(self::parseRoute($idCourse))->with('msg_error', Lang::get('messages.contents_display_err')); } else { $content = CoursesSection::find($idContent); $delete = CoursesSection::destroy($idContent); if (!$delete) { return Redirect::to(self::parseRoute($idCourse))->with('msg_error', Lang::get('messages.contents_delete_err', array('title' => $content->title))); } else { return Redirect::to(self::parseRoute($idCourse))->with('msg_success', Lang::get('messages.contents_delete', array('title' => $content->title))); } } }