本文整理汇总了PHP中app\Student::filter方法的典型用法代码示例。如果您正苦于以下问题:PHP Student::filter方法的具体用法?PHP Student::filter怎么用?PHP Student::filter使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类app\Student
的用法示例。
在下文中一共展示了Student::filter方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: all
/**
* Show all students for reports/searching
*
* @param StudentFilter $filter
*
* @return \BladeView|bool|\Illuminate\Contracts\View\Factory|\Illuminate\Http\JsonResponse|\Illuminate\View\View
*/
public function all(StudentFilter $filter)
{
if (count(request()->query())) {
if (request()->ajax()) {
$students = Student::filter($filter);
//save to session for printing
session()->put('students', $students);
$students = $students->paginate(10);
return response()->json(['results' => view('reports._results', ['students' => $students])->render(), 'count' => $students->total()], 200);
}
}
//clear session
session()->forget('students');
$years = config('student.year_level');
$cities = config('student.cities');
$brackets = config('student.brackets');
$sections = Section::get(['id', 'description']);
return view('reports.all', compact(['years', 'sections', 'cities', 'brackets']));
}