/** * Display a listing of the resource. * * @return Response */ public function index($id) { if (!$this->checkProjectTaskPermissions($id)) { return ['error' => 'Access Forbidden']; } return $this->repository->findWhere(['project_id' => $id]); }
/** * Find a project note by its ID * * @param integer $id project id * @return json */ public function find($id, $noteId) { $note = $this->repository->findWhere(['project_id' => $id, 'id' => $noteId]); if ($note->count()) { return $note; } return ['error' => true, 'message' => 'Nenhuma task encontrada']; }
public function show($id, $noteId) { try { return $this->repository->findWhere(['project_id' => $id, 'id' => $noteId]); } catch (ValidatorException $e) { return response()->json(['error' => true, 'message' => $e->getMessageBag()]); } catch (ModelNotFoundException $e) { return response()->json(['error' => true, 'message1' => $e->getMessage(), 'message2' => 'Project Note ID ' . $noteId . ' nao encontrado.']); } }
public function find($projectId, $id) { try { $data = $this->repository->findWhere(['project_id' => $projectId, 'id' => $id]); if (isset($data['data']) && count($data['data'])) { return ['data' => current($data['data'])]; } return $data; } catch (\Exception $e) { return ["error" => true, "message" => 'Registro não encontrado.', "messageDev" => $e->getMessage()]; } }
/** * Display the specified resource. * * @param int $id * @return \Illuminate\Http\Response */ public function show($id, $noteId) { return $this->repository->findWhere(['project_id' => $id, 'id' => $noteId]); //correção para não usar o Transform no Angular /* $result = $this->repository->findWhere(['project_id' => $id, 'id' => $noteId]); if (isset($result['data']) && count($result['data']) == 1){ $result = [ 'data' => $result['data'][0]; ]; } return $result; */ }
public function getAllByProject($projectId) { return $this->repository->findWhere(['project_id' => $projectId]); }
/** * Display the specified resource. * * @param int $id * @return Response */ public function show($projectId, $taskId) { return $this->repository->findWhere(['project_id' => $projectId, 'id' => $taskId]); }
/** * Display the specified resource. * * @param int $id * @return Response */ public function show($id, $noteId) { return $this->repository->findWhere(['project_id' => $id, 'id' => $noteId]); }