/** * Display a listing of the resource. * * @return Response */ public function index() { // $student = Student::latest()->published()->get(); return view('student.index', compact('student')); //return $student; }
public function index(Request $request) { $students = Student::latest()->get(); if ($request->ajax() || $request->wantsJson()) { return new JsonResponse($students); } return view('students.index', compact('students')); }
/** * Display a listing of the resource. * * @return Response */ public function index() { $this->authorize('index', new Student()); $students = Student::latest()->get(); return view('student.index', compact('students')); }