Example #1
0
 public function create()
 {
     $years = config('student.year_level');
     $cities = config('student.cities');
     $states = config('student.states');
     $sections = Section::get(['id', 'description']);
     return view('students.add', compact(['years', 'sections', 'cities', 'states']));
 }
 /**
  * Show all students for reports/searching
  *
  * @param StudentSearch $request
  * @return \BladeView|bool|\Illuminate\Contracts\View\Factory|\Illuminate\Http\JsonResponse|\Illuminate\View\View
  */
 public function all(StudentSearch $request)
 {
     if (count($request->query())) {
         if ($request->ajax()) {
             $students = $this->createQuery($request);
             //save to session for printing
             session()->put('students', $request->all());
             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']));
 }