本文整理匯總了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'));
}
示例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);
}