/** * Remove the specified resource from storage. * * @param int $id * @return Response */ public function destroy(Motion $motion) { if (Auth::user()->id != $motion->user_id && !Auth::user()->can('delete-motions')) { abort(401, "You do not have permission to delete this motion"); } $votes = $motion->votes; if (!$votes) { //Has not recieved votes $motion->forceDelete(); return $motion; } $motion->active = 0; $motion->save(); $motion->delete(); //Motion kept in the database return $motion; }