/** * Remove the specified resource from storage. * * @param int $id * @return \Illuminate\Http\Response */ public function destroy($id, $noteId) { if ($this->repository->skipPresenter()->find($noteId)->delete()) { return ['success' => true, 'message' => 'Nota ' . $noteId . ' excluída com sucesso!']; } return ['error' => true, 'message' => 'Não foi possível excluir a nota ' . $noteId]; }
/** * Display a listing of the resource. * * @return Response */ public function index($id) { if ($this->checkProjectPermissions($id) == false) { return ['error' => 'Access Forbidden']; } //$this->repository->with('project'); //return $this->repository->all(); return $this->repository->findWhere(['project_id' => $id]); }
public function destroy($id, $noteId) { if (count(self::show($id, $noteId)) == 0) { return ['error' => true, 'message' => 'Nao encontrado']; } else { $this->repository->delete($noteId); return ['error' => true, 'message' => 'Nota ' . $noteId . ' do Projeto Excluido']; } }
public function update(array $data, $id) { try { $this->validator->with($data)->passesOrFail(); return $this->repositoy->update($data, $id); } catch (ValidatorException $e) { return ['error' => true, 'message' => $e->getMessageBag()]; } }
public function destroy($note_id) { try { $this->repository->delete($note_id); #acento aqui funcionou normal return "Nota id:{$note_id} deletado com sucesso"; } catch (ModelNotFoundException $e) { return ['error' => true, 'message' => 'A nota que está tentando deletar não existe']; } }
public function delete($id) { try { if ($this->repository->find($id)->delete()) { return ['error' => false, 'message' => 'Projeto deletado.']; } } catch (ModelNotFoundException $e) { return ['error' => true, 'message' => 'Projeto não encontrado.']; } }
/** * @param $projectId * @param $noteId * @return array|mixed */ public function show($projectId, $noteId) { try { $result = $this->repository->find($noteId); return $result; } catch (ModelNotFoundException $e) { return ['error' => true, 'message' => 'Não foi possível encontrar o registro']; } catch (\Exception $e) { return ["error" => true, "message" => $e->getMessage()]; } }
public function destroy($noteId) { try { if ($this->repository->delete($noteId)) { return ['success', 'message' => 'Registro excluído']; } return ['error' => true, 'message' => 'Erro desconhecido ao tentar excluir o registro']; } catch (\Exception $e) { return ["error" => true, "message" => $e->getMessage()]; } }
public function destroy($id) { try { $project = $this->repository->find($id); $project->delete(); $msg['status'] = "Y"; $msg['message'] = "Successfully deleted record"; return $msg; } catch (ValidatorException $ex) { return ['error' => true, 'message' => $ex->getMessageBag()]; } }
public function update(array $data, $id) { try { $this->validator->with($data)->passesOrFail(ValidatorInterface::RULE_UPDATE); return $this->repository->setPresenter($this->presenter)->update($data, $id); } catch (ValidatorException $e) { return ['error' => true, 'message' => $e->getMessageBag(), "messageDev" => 'ValidatorException']; } catch (ModelNotFoundException $e) { return ['error' => true, 'message' => 'Registro não encontrado.', "messageDev" => $e->getMessage()]; } catch (\Exception $e) { return ["error" => true, "message" => 'Falha ao atualizar dados.', "messageDev" => $e->getMessage()]; } }
/** * Remove the specified resource from storage. * * @param int $id * @return Response */ public function destroy($id, $noteId) { $this->repository->delete($noteId); /* $projectNote = $this->repository->skipPresenter()->find($id); //$result = $this->repository->delete($id); $projectId = $projectNote->project_id; if($this->checkProjectNotePermissions($projectId) == false){ return ['error' => 'Access Forbidden']; } $result = $projectNote->delete(); if($result) return ['error' => 0]; return ['error' => 1, 'msg' => 'Erro ao tentar deletar a Task Note']; /* $result = $this->repository->find($id)->delete(); if($result) return ['error' => 0]; return ['error' => 1, 'msg' => 'Erro ao tentar deletar o Projecte']; */ }
/** * @param $projectId * @param $noteId */ public function delete($noteId) { try { return $this->repository->delete($noteId) ? 'Deletado' : 'Não foi possível deletar'; //findWhere(['project_id' => $projectId, 'id' => $noteId])->delete() ? 'Deletado' : 'Não foi possível deletar'; } catch (\Exception $e) { return ['error' => true, 'message' => 'An error ocurred on delete note ']; } }
/** * Remove the specified resource from storage. * * @param int $id * @return \Illuminate\Http\Response */ public function destroy($id, $noteId) { try { if ($this->repository->delete($noteId)) { return ['success' => true, 'message' => 'Nota apagado com sucesso!']; } } catch (ModelNotFoundException $e) { return ['error' => true, 'message' => 'Não foi possível apagar a nota! Projeto ou nota não encontrado!']; } }
public function delete($id, $noteId) { try { $this->repository->delete($noteId); return ['success' => true]; } catch (ModelNotFoundException $e) { return ['error' => true, 'message' => 'No data found.']; } catch (\Exception $e) { return ['error' => true, 'message' => 'An error occurred when trying to delete the data. Try again later.']; } }
/** * @param $id * @return \Illuminate\Http\JsonResponse */ public function destroy($id) { try { $this->repository->delete($id); $msg = "Nota {$id} removida com sucesso."; Log::info($msg); return response()->json([$msg], 200); } catch (ModelNotFoundException $e) { return response()->json([$e->getMessage()], 404); } //QueryException tratado em Exceptions/Handler.php }
public function delete($note_id) { $note = ProjectNote::find($note_id); if (is_null($note)) { return Errors::invalidId($note_id); } $user_id = \Authorizer::getResourceOwnerId(); if (!$this->projectRepository->isMember($note->project_id, $user_id)) { return Errors::basic('Acesso negado. Você não é membro do projeto desta nota.'); } $this->repository->delete($note_id); return ['message' => "Registro deletado!"]; }
/** * Remove the specified resource from storage. * * @param int $id * @return \Illuminate\Http\Response */ public function destroy($id, $noteId) { if ($this->projectService->checkProjectPermissions($id) == false) { return ['error' => 'Access forbidden']; } try { $projectNote = $this->repository->skipPresenter()->find($noteId); if (empty($projectNote)) { return ['error' => 'ProjectNote not found']; } $projectNote->delete(); } catch (\Exception $e) { return ['error' => $e->getMessage()]; } }
/** * Remove the specified resource from storage. * * @param int $id * @return Response */ public function destroy($id, $noteId) { $this->repository->delete($noteId); }
/** * Remove the specified resource from storage. * * @param int $id * @return Response */ public function destroy($id) { return ['success' => $this->repository->delete($id)]; }
public function show($id, $noteId) { return $this->repository->findWhere(['project_id' => $id, 'id' => $noteId]); }
private function checkProjectOwner($projectId) { $userId = \Authorizer::getResourceOwnerId(); return $this->repository->skipPresenter()->isOwner($projectId, $userId); }
/** * Remove the specified resource from storage. * * @param int $id * @param $note_id * @return \Illuminate\Http\Response */ public function destroy($id, $note_id) { $this->repository->find($note_id)->delete(); }
private function setPresenter() { $this->repository->setPresenter('CodeProject\\Presenters\\ProjectNotePresenter'); }
/** * Remove the specified resource from storage. * * @param int $id * @return Response */ public function destroy($id) { if ($this->repository->delete($id)) { return ['success' => true]; } }
public function find($id) { return $this->repository->with(['owner', 'client'])->find($id); }
/** * Remove the specified resource from storage. * * @param int $id * @return \Illuminate\Http\Response */ public function destroy($noteId) { return $this->repository->delete($noteId); }
/** * Remove the specified resource from storage. * * @param int $id * @return \Illuminate\Http\Response */ public function destroy($id, $noteId) { //Client::find($id)->delete(); $this->repository->delete($noteId); }
public function update(array $data, $id) { return $this->repository->update($data, $id); }
/** * Display a listing of the resource. * * @return Response */ public function index($id) { // return $this->repository->with(['owner','client'])->all(); return $this->repository->findWhere(['project_id' => $id]); }
/** * Remove the specified resource from storage. * * @param int $id * @return Response */ public function destroy($id, $noteId) { return ['success' => $this->repository->delete($noteId)]; //['success' => Client::find($id)->delete()]; }