/** * * @return Response */ public function searchAndPaginateAjax(Request $request) { $search_key = $request->input('search_key'); $page = $request->input('page'); if ($search_key) { $students = $this->student->getSearchResults($search_key, $page, self::PAGE); } else { $students = $this->student->paginate(self::PAGE)->setPath('students'); } return view('students._list_students', compact('students')); }