示例#1
0
 public function show()
 {
     // TODO: Replace with actual
     $popular = new \stdClass();
     $popular->name = "Populares";
     $popular->courses = Course::whereIn('slug', ['netflix', 'email', 'homebanking-caixa'])->get();
     $best_rated = new \stdClass();
     $best_rated->name = "Melhor avaliados";
     $best_rated->courses = Course::whereIn('slug', ['google-maps', 'conheca-televisao-meo', 'email'])->get();
     $courses = [$popular, $best_rated];
     $breadcrumbs = array(action('HomeController@show') => 'Início');
     return view('home', compact('breadcrumbs', 'courses'));
 }
 public function getRecords(SearchCourseRequest $request)
 {
     //Get level records
     $levelString = implode(',', $request->input('level'));
     $levels = explode(',', $levelString);
     //Get Method records
     $methodString = implode(',', $request->input('method'));
     $methods = explode(',', $methodString);
     //Get Paper records
     $paperString = implode(',', $request->input('paper'));
     $papers = explode(',', $paperString);
     //Get Element records
     $elementString = implode(',', $request->input('element'));
     $elements = explode(',', $elementString);
     //Get Centre records
     $centreString = implode(',', $request->input('centre'));
     $centres = explode(',', $centreString);
     $courseLevels = Course::whereIn('level_id', $levels)->whereIn('method_id', $methods)->whereIn('paper_id', $papers)->whereIn('element_id', $elements)->whereIn('centre_id', $centres)->get();
     $centreList = Centre::whereIn('id', $centres)->get();
     return view('acca.results')->with('centres', $centreList)->with('courses', $courseLevels);
 }