本文整理汇总了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);
}