/** * @SWG\Api( * path="/add", * @SWG\Operation( * method="POST", * summary="Add Protection", * notes="", * type="void", * authorizations={}, * @SWG\Parameter( * name="name", * description="Application Name.", * required=true, * type="string", * paramType="form" * ), * @SWG\Parameter( * name="enabled", * description="Is this Application Enabled?", * required=true, * type="boolean", * paramType="form" * ), * @SWG\ResponseMessage(code=200, message="Successfull Added."), * @SWG\ResponseMessage(code=405, message="Invalid Input.") * ) * ) */ public function add() { $this->load->model("protection_model", "lProtectionModel"); $lProtections = protection_item::add($this->input->post('name'), $this->input->post('enabled') == protection::BOOL_TRUE ? 1 : 0); if (count($lProtections) == 0) { http_response_code(response_codes::InvalidInput); } else { $this->lProtectionModel->add($lProtections); } }