예제 #1
0
 /**
  * Display the specified resource.
  *
  * @param  int  $id
  * @return Response
  */
 public function show($projectId, $id)
 {
     if ($this->checkProjectTaskPermissions($projectId) == false) {
         return ['error' => 'Access Forbidden'];
     }
     return $this->repository->find($id);
 }
 public function show($id, $taskId)
 {
     try {
         return $this->repository->find($taskId);
     } catch (\Exception $e) {
         return ['error' => true, 'message' => 'Registro não encontrado.'];
     }
 }
 public function delete($noteId)
 {
     try {
         $this->repository->find($noteId)->delete();
     } catch (\Exception $e) {
         return ['error' => true, 'message' => $e->getMessage()];
     }
 }
 /**
  * Display the specified resource.
  *
  * @param  int $id
  * @param $taskId
  * @return Response
  */
 public function show($id, $taskId)
 {
     try {
         //$project = $this->repository->findWhere(['project_id' => $id, 'id' => $taskId]);
         $project = $this->repository->find($taskId);
         return $project;
     } catch (ModelNotFoundException $e) {
         return ['error' => true, 'message' => 'ProjectNote not found'];
     }
 }
 /**
  * Remove the specified resource from storage.
  *
  * @param  int  $id
  * @return \Illuminate\Http\Response
  */
 public function destroy($id)
 {
     try {
         $this->repository->find($id)->delete();
     } catch (ModelNotFoundException $e) {
         return "Task not found";
     }
 }
 /**
  * Display the specified resource.
  *
  * @param  int  $id
  * @return Response
  */
 public function show($id, $idTask)
 {
     return $this->repository->find($idTask);
     /*
     $result = $this->repository->findWhere(['project_id' => $id, 'id' => $idTask]);
     if(isset($result['data']) && count($result['data']) == 1){
         $result = [
             'data' => $result['data'][0]
         ];
     }
     return $result;
     /*
     
     if($this->checkProjectTaskPermissions($projectId) == false){
         return ['error' => 'Access Forbidden'];
     }
     
     return $this->repository->find($id);
     */
 }
 public function removeTask($project_id, $task_id)
 {
     try {
         $this->taskRepository->find($task_id)->delete();
         return ['success' => true, 'message' => 'Tarefa deletada com sucesso!'];
     } catch (QueryException $e) {
         return $this->erroMsgm('Tarefa não pode ser apagado pois existe um projeto vinculado a ela.');
     } catch (ModelNotFoundException $e) {
         return $this->erroMsgm('Tarefa não encontrada.');
     } catch (\Exception $e) {
         return $this->erroMsgm('Ocorreu um erro ao excluir a tarefa.');
     }
 }
예제 #8
0
 public function find($project_id, $task_id)
 {
     $task = ProjectTask::find($task_id);
     if (is_null($task)) {
         return Errors::invalidId($task_id);
     }
     if (is_null(Project::find($project_id))) {
         return Errors::invalidId($project_id);
     }
     if ($task->project_id != $project_id) {
         return Errors::basic("Falha. Projeto " . $project_id . " nao possui a tarefa " . $task_id);
     }
     return $this->repository->find($task_id);
 }
 /**
  * Display the specified resource.
  *
  * @param  int  $id
  * @return Response
  */
 public function show($id, $idTask)
 {
     return $this->repository->find($idTask);
 }
 /**
  * Remove the specified resource from storage.
  *
  * @param  int $id
  * @return Response
  */
 public function destroy($id)
 {
     $this->repository->find($id)->delete();
 }