コード例 #1
0
 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]);
 }
コード例 #2
0
 /**
  * Display the specified resource.
  *
  * @param  int  $id
  * @return \Illuminate\Http\Response
  */
 public function show($id, $noteId)
 {
     $result = $this->repository->findWhere(['project_id' => $id, 'id' => $noteId]);
     if (isset($result['data']) && count($result['data']) == 1) {
         $result = ['data' => $result['data'][0]];
     }
     return $result;
 }
コード例 #3
0
 public function show($id, $noteId)
 {
     if ($this->checkProjectOwner($id) == false) {
         return ['error' => 'Access Forbidden'];
     }
     $projectNote = $this->repository->findWhere(['project_id' => $id, 'id' => $noteId]);
     return $projectNote[0]->project;
 }
コード例 #4
0
 /**
  * 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]);
 }
コード例 #5
0
 /**
  * Display a listing of the resource.
  *
  * @return Response
  */
 public function index($projectId)
 {
     if ($this->checkProjectNotePermissions($projectId) == false) {
         return ['error' => 'Access Forbidden'];
     }
     //return $this->repository->all();
     //return $this->repository->with(['client', 'user'])->all();
     return $this->repository->findWhere(['project_id' => $projectId]);
 }
コード例 #6
0
 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.'];
     }
 }
コード例 #7
0
 /**
  * @param $projectId
  * @param $noteId
  * @return array|mixed
  */
 public function find($projectId, $noteId)
 {
     try {
         $result = $this->repository->findWhere(['project_id' => $projectId, 'id' => $noteId]);
         if (isset($result['data']) && count($result['data']) == 1) {
             $result = ['data' => $result['data'][0]];
         }
         return $result;
     } catch (\Exception $e) {
         return ['error' => true, 'message' => 'Project does not exist'];
     }
 }
コード例 #8
0
 /**
  * Display the specified resource.
  *
  * @param  int $id
  * @param $idNote
  * @return Response
  */
 public function show($id, $idNote)
 {
     try {
         $result = $this->repository->findWhere(['project_id' => $id, 'id' => $idNote]);
         if (isset($result['data']) && count($result['data']) == 1) {
             $result = ['data' => $result['data'][0]];
         }
         return $result;
     } catch (ModelNotFoundException $e) {
         return ['error' => true, 'message' => 'ProjectNote not found'];
     }
 }
コード例 #9
0
 public function show($project_id, $note_id)
 {
     try {
         #$rtrn = $this->repository->skipPresenter()->findWhere(['project_id'=>$project_id, 'id'=>$note_id]);
         $rtrn = $this->repository->findWhere(['project_id' => $project_id, 'id' => $note_id])->first();
         #$rtrn = $this->repository->skipPresenter()->where()
         #dd($rtrn);
         return $rtrn;
     } catch (ModelNotFoundException $e) {
         return ['error' => true, 'message' => 'Nota não existe'];
     }
 }
コード例 #10
0
 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()];
     }
 }
コード例 #11
0
 /**
  * Display the specified resource.
  *
  * @param  int  $id
  * @return Response
  */
 public function show($id, $idNote)
 {
     $result = $this->repository->findWhere(['project_id' => $id, 'id' => $idNote]);
     if (isset($result['data']) && count($result['data']) == 1) {
         $result = ['data' => $result['data'][0]];
     }
     return $result;
     /*
     if($this->checkProjectNotePermissions($projectId) == false){
         return ['error' => 'Access Forbidden'];
     }
     
     return $this->repository->find($id);
     //return $this->repository->with(['client', 'user'])->find($id);
     */
 }
コード例 #12
0
 /**
  * @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
 }
コード例 #13
0
 /**
  * Display the specified resource.
  *
  * @param  int  $id
  * @return Response
  */
 public function show($id, $noteId)
 {
     return $this->repository->findWhere(['id' => $noteId, 'project_id' => $id]);
 }
コード例 #14
0
 /**
  * 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]);
 }
コード例 #15
0
 /**
  * @param $projectId
  * @return array|mixed
  */
 public function index($projectId)
 {
     return $this->repository->findWhere(['project_id' => $projectId]);
 }
コード例 #16
0
 /**
  * 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]);
     //return Client::find($id);
 }