public function excluir() { try { $id = array_key_exists('id', $_POST) ? $_POST['id'] : null; if (empty($id)) { throw new \Exception("Selecione uma categoria."); } $categoria = new CategoriaOS(); $categoria->id = $id; $this->fachada->excluirCategoriaOS($categoria); echo new JSONResponse(true, self::MSG_OPERACAO_SUCESSO); } catch (\Exception $e) { echo new JSONResponse(false, $e->getMessage()); } }