/** * Display a listing of the resource. * * @return \Illuminate\Http\Response */ public function index(Request $request) { $teachTimes = TeachTime::orderBy('type')->orderBy('priority')->get(); if ($request->ajax()) { return $teachTimes->toArray(); } return view('admin.teachtimes.index', ['teachtimes' => $teachTimes]); }