コード例 #1
0
 /**
  * Remove the specified resource from storage.
  *
  * @param  int $id
  * @return \Illuminate\Http\Response
  */
 public function destroy($id, $taskId)
 {
     try {
         return ['success' => $this->repository->delete($taskId)];
     } catch (ModelNotFoundException $e) {
         return response()->json(['Erro' => '1', 'Mensagem' => 'Registro nao localizado']);
     }
 }
コード例 #2
0
 /**
  * Remove the specified resource from storage.
  *
  * @param  int  $id
  * @return \Illuminate\Http\Response
  */
 public function destroy($id)
 {
     try {
         $this->repository->delete($id);
         return ['status' => 'success', 'message' => 'ProjectTask removed'];
     } catch (ModelNotFoundException $e) {
         return ['error' => true, 'message' => 'ProjectTask not Found'];
     }
 }
コード例 #3
0
 public function destroy($id, $taskId)
 {
     if (count(self::show($id, $taskId)) == 0) {
         return ['error' => true, 'message' => 'Nao encontrado'];
     } else {
         $this->repository->delete($taskId);
         return ['error' => true, 'message' => 'Nota ' . $taskId . ' do Projeto Excluido'];
     }
 }
コード例 #4
0
 public function delete($id)
 {
     try {
         if ($this->repository->delete($id)) {
             return ['success' => true, 'message' => 'Tarefa apagado com sucesso!'];
         }
     } catch (ModelNotFoundException $e) {
         return ['error' => true, 'message' => 'Não foi possível apagar a tarefa! Projeto ou tarefa não encontrado!'];
     }
 }
コード例 #5
0
 public function destroy($project_id, $task_id)
 {
     try {
         $this->repository->delete($task_id);
         #acento aqui funcionou normal
         return "Nota id:{$task_id} deletado com sucesso";
     } catch (ModelNotFoundException $e) {
         return ['error' => true, 'message' => 'A tarefa que está tentando deletar não existe'];
     }
 }
コード例 #6
0
 public function destroy($taskId)
 {
     try {
         $this->repository->delete($taskId);
     } catch (ValidatorException $e) {
         return response()->json(['error' => true, 'message' => $e->getMessageBag()]);
     } catch (ModelNotFoundException $e) {
         return response()->json(['error' => true, 'message1' => $e->getMessage(), 'message2' => 'Project Task ID ' . $taskId . ' nao encontrado.']);
     }
 }
コード例 #7
0
 /**
  * @param $taskId
  * @return array
  */
 public function destroy($taskId)
 {
     try {
         if ($this->repository->delete($taskId)) {
             return ['success' => true, 'message' => 'Registro excluído'];
         }
         return ['error' => true, 'message' => 'Erro desconhecido ao tentar excluir o registro'];
     } catch (\Exception $e) {
         return ["error" => true, "message" => $e->getMessage()];
     }
 }
コード例 #8
0
 public function delete($projectId, $id)
 {
     try {
         $this->repository->delete($id);
         return ['success' => true, "message" => 'Registro excluído com sucesso.'];
     } catch (ModelNotFoundException $e) {
         return ['error' => true, 'message' => 'Registro não encontrado.', "messageDev" => $e->getMessage()];
     } catch (QueryException $e) {
         return ['error' => true, 'message' => 'Este registro não pode ser excluído, pois existe um ou mais projetos vinculados a ele.', "messageDev" => $e->getMessage()];
     } catch (\Exception $e) {
         return ["error" => true, "message" => 'Falha ao excluir registro.', "messageDev" => $e->getMessage()];
     }
 }
コード例 #9
0
 public function delete($id, $taskId)
 {
     try {
         $this->repository->delete($taskId);
         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.'];
     }
 }
コード例 #10
0
 /**
  * @param $id
  * @return \Illuminate\Http\JsonResponse
  */
 public function destroy($id)
 {
     try {
         $this->repository->delete($id);
         $msg = "Tarefa {$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
 }
コード例 #11
0
 public function delete($task_id)
 {
     $task = ProjectTask::find($task_id);
     if (is_null($task)) {
         return Errors::invalidId($task_id);
     }
     $user_id = \Authorizer::getResourceOwnerId();
     if (!$this->projectRepository->isMember($task->project_id, $user_id)) {
         return Errors::basic('Acesso negado. Você não é membro do projeto desta tarefa.');
     }
     $this->repository->delete($task_id);
     return ['message' => "Registro deletado!"];
 }
コード例 #12
0
 /**
  * Remove the specified resource from storage.
  *
  * @param  int  $id
  * @return Response
  */
 public function destroy($id)
 {
     if ($this->repository->delete($id)) {
         return ['success' => true];
     }
 }
コード例 #13
0
 /**
  * Remove the specified resource from storage.
  *
  * @param  int $id
  * @param $taskId
  * @return \Illuminate\Http\Response
  */
 public function destroy($id, $taskId)
 {
     $this->repository->delete($taskId);
 }
コード例 #14
0
 /**
  * Remove the specified resource from storage.
  *
  * @param $task
  * @return Response
  * @internal param int $id
  */
 public function destroy($task)
 {
     if ($this->repository->delete($task)) {
         return 'Deletado';
     }
 }