/** * Remove the specified resource from storage. * * @param int $id * @return Response */ public function destroy($id) { $vote = Vote::find((int) $id); if ($vote->debates->first()) { Post::create(['user_id' => Auth::user()->id, 'debate_id' => $vote->debates->first()->id, 'message' => '<p>Le vote a été annulé.</p>']); } Vote::destroy($vote->id); return back()->with('message', 'Vote supprimé avec succès.'); }