public function destroy(Request $request, Student $student) { $student->delete(); if ($request->ajax() || $request->wantsJson()) { return new JsonResponse($student); } return redirect('students'); }
/** * Remove the specified resource from storage. * * @param int $id * @return \Illuminate\Http\Response */ public function destroy(Request $request, Student $student) { $student->delete(); if ($request->ajax() || $request->wantsJson()) { return new JsonResponse($student); } flash()->success('cancellato tutto!'); return redirect('students'); }