當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Course::whereIn方法代碼示例

本文整理匯總了PHP中app\Course::whereIn方法的典型用法代碼示例。如果您正苦於以下問題:PHP Course::whereIn方法的具體用法?PHP Course::whereIn怎麽用?PHP Course::whereIn使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在app\Course的用法示例。


在下文中一共展示了Course::whereIn方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: show

 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'));
 }
開發者ID:joaopluis,項目名稱:oldschool,代碼行數:13,代碼來源:HomeController.php

示例2: getRecords

 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);
 }
開發者ID:KaplanDigitalMarketing,項目名稱:Timetables,代碼行數:21,代碼來源:AccaController.php


注:本文中的app\Course::whereIn方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。