public function all($project_id) { if (is_null(Project::find($project_id))) { return Errors::invalidId($project_id); } return $this->repository->findWhere(['project_id' => $project_id]); }
/** * @param $id * @param $noteId * @return array|\Illuminate\Http\JsonResponse|\Symfony\Component\HttpFoundation\Response */ public function show($id, $taskId) { try { return $this->repository->findWhere(['project_id' => $id, 'id' => $taskId]); } catch (ModelNotFoundException $e) { return response()->json(['Erro' => '1', 'Mensagem' => 'Registro nao localizado']); } }
/** * 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]); }
/** * Display the specified resource. * * @param int $id * @return Response */ public function show($id, $taskId) { try { $project = $this->repository->findWhere(['project_id' => $id, 'id' => $taskId]); return $project; } catch (ModelNotFoundException $e) { return ['error' => true, 'message' => 'ProjectNote not found']; } }
/** * Display a listing of the resource. * * @return Response */ public function index($projectId) { //if($this->checkProjectTaskPermissions($projectId) == false){ // return ['error' => 'Access Forbidden']; //} return $this->repository->findWhere(['project_id' => $projectId]); //return $this->repository->all(); //return $this->repository->with(['client', 'user'])->all(); //return $this->repository->findWhere(['project_id' => $id]); }
public function index($id) { try { return $this->repository->findWhere(['project_id' => $id]); } catch (ModelNotFoundException $e) { return ['error' => true, 'message' => 'No data found.']; } catch (\Exception $e) { return ['error' => true, 'message' => 'An error occurred when trying to find the data. Try again later.']; } }
public function show($id, $taskId) { try { return $this->repository->findWhere(['project_id' => $id, 'id' => $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.']); } }
public function show($project_id, $task_id) { try { $rtrn = $this->repository->findWhere(['project_id' => $project_id, 'id' => $task_id]); #dd($rtrn['data'][0]); #dd($rtrn); $rtrn = $rtrn['data'][0]; return $rtrn; } catch (ModelNotFoundException $e) { return ['error' => true, 'message' => 'Tarefa não existe']; } }
public function find($id, $noteId) { try { $this->setPresenter(); $result = $this->repository->findWhere(['project_id' => $id, 'id' => $noteId]); if (isset($result['data']) && count($result['data'] == 1)) { $result = ['data' => $result['data'][0]]; } return $result; } catch (\Exception $e) { return ['error' => true, 'message' => $e->getMessage()]; } }
/** * Display the specified resource. * * @param int $id * @param int $taskId * * @return \Illuminate\Http\Response */ public function show($id, $taskId) { if ($this->projectService->checkProjectPermissions($id) == false) { return ['error' => 'Access forbidden']; } return $this->repository->findWhere(['project_id' => $id, 'id' => $taskId]); }
/** * @param $projectId * @return \Illuminate\Http\JsonResponse|mixed */ public function all($projectId) { try { return $this->repository->findWhere(['project_id' => $projectId]); } catch (ModelNotFoundException $e) { return response()->json([$e->getMessage()], 404); } //QueryException tratado em Exceptions/Handler.php }
/** * Display a listing of the resource * * @param $id * @return Response */ public function index($id) { return $this->repository->findWhere(['project_id' => $id]); }
/** * Display the specified resource. * * @param int $id * @param $taskId * @return \Illuminate\Http\Response */ public function show($id, $taskId) { return $this->repository->findWhere(['project_id' => $id, 'id' => $taskId]); }