/** * Remove the specified resource from storage. * * @param int $id * @return Response */ public function destroy(Request $request) { $participant = Participant::where('user_id', '=', $request->user_id)->where('event_id', '=', $request->event_id); $participant->delete(); return back()->with('status', 'You have been removed!'); }
/** * Remove the specified resource from storage. * * @param int $id * @return Response */ public function destroy($id) { // Delete the event $event = Event::findOrFail($id); $event->delete(); // Delete all participants related to this event $participants = Participant::where('event_id', '=', $id); $participants->delete(); return redirect('event')->with('status', 'Boom! Event gone!'); }