/** * POST /issues/delete/@id * Delete an issue * * @param \Base $f3 * @param array $params * @throws \Exception */ public function single_delete($f3, $params) { $issue = new \Model\Issue(); $issue->load($params["id"]); $user = $f3->get("user_obj"); if ($user->role == "admin" || $user->rank >= \Model\User::RANK_MANAGER || $issue->author_id == $user->id) { $issue->delete(); $f3->reroute("/issues/{$issue->id}"); } else { $f3->error(403); } }
public function single_delete($f3, $params) { $issue = new \Model\Issue(); $issue->load($params["id"]); $issue->delete(); if (!$issue->id) { $f3->error(404); return; } $this->_printJson(array("deleted" => $params["id"])); }