public function json(Request $request) { $field = $request->get('field'); $keyword = $request->get('keyword'); $courses = Course::getCourse($field, $keyword); return response()->json($courses); }