/** * Remove the specified resource from storage. * * @param int $id * @return Response */ public function destroy(Request $request, $id, $subjectId) { $classe = Classe::find($id); if ($request->get('agree') == 1) { $classe->subjects()->detach($subjectId); return redirect()->route("classes.subjects.index", [$id])->with('message', '<p class="alert alert-success text-center">Subject Deleted</p>'); } return redirect()->route("classes.subjects.index", [$id]); }
/** * Remove the specified resource from storage. * * @param int $id * @return Response */ public function destroy($id, Request $request) { $class = Classe::find($id); if ($request->get('agree') == 1) { $class->delete(); return redirect()->route('classes.index')->with('message', '<p class="alert alert-danger">Class Deleted</p>'); } return redirect('classes'); }