예제 #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]);
 }
 /**
  * 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;
 }
 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;
 }
 /**
  * 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.'];
     }
 }
 /**
  * @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'];
     }
 }
 /**
  * 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'];
     }
 }
 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
  * @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);
     */
 }
 /**
  * @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 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]);
 }
 /**
  * @param $projectId
  * @return array|mixed
  */
 public function index($projectId)
 {
     return $this->repository->findWhere(['project_id' => $projectId]);
 }
 /**
  * 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);
 }