public function find($id) { if (is_null(Project::find($id))) { return Errors::invalidId($id); } return $this->repository->with(['client', 'owner'])->find($id); }
/** * Display the specified resource. * * @param int $id * @return \Illuminate\Http\Response */ public function show($id) { if ($this->checkProjectPermissions($id) == false) { return "Access Forbidden"; } return $this->repository->with('client')->with('user')->findOrFail($id); }
/** * Display the specified resource. * * @param int $id * @return Response */ public function show($id) { // if ($this->checkProjectOwner($id)==false){ // return ['error' => 'Access forbidden']; // } return $this->repository->with(['owner', 'client'])->find($id); }
/** * Display the specified resource. * * @param int $id * @return \Illuminate\Http\Response */ public function show($id) { if ($this->checkProjectPermissions($id) == false) { return ['msg' => 'Forbidden']; } return $this->repository->with(['owner', 'notes', 'client', 'members'])->find($id); }
public function listMembers($id_project) { try { return $this->repository->with(['members'])->find($id_project); } catch (ModelNotFoundException $e) { return ['error' => true, 'message' => 'Projeto não existe']; } }
public function getProject($id = "") { if ($id) { return $this->repository->with(['owner', 'client'])->find($id); } else { return $this->repository->with(['owner', 'client'])->all(); } }
public function show($id) { try { return ["success" => $this->repository->with(['owner', 'client'])->find($id)]; } catch (ModelNotFoundException $e) { return ["success" => false, "message" => "Projeto ID: {$id} inexistente!"]; } }
public function show($id) { try { return $this->repository->with(['owner', 'client', 'notes', 'tasks', 'members'])->find($id); } catch (ModelNotFoundException $e) { return ['error' => true, 'message' => $e->getMessage()]; } }
public function read($id) { try { return response()->json($this->repository->with(['owner', 'client'])->find($id)); } catch (ModelNotFoundException $ex) { return response()->json(['error' => true, 'message' => "Project id {$id} not found"]); } }
public function find($id) { try { $this->setPresenter(); return $this->repository->with(['owner', 'client'])->find($id); } catch (\Exception $e) { return ['error' => true, 'message' => $e->getMessage()]; } }
/** * Display the specified resource. * * @param int $id * @return \Illuminate\Http\Response */ public function show($id) { try { return $this->repository->with(['owner', 'client'])->find($id); } catch (ModelNotFoundException $e) { return $this->erroMsgm('Projeto não encontrado.'); } catch (\Exception $e) { return $this->erroMsgm('Ocorreu um erro ao exibir o projeto.'); } }
/** * @param $id * @return array|mixed */ public function find($id) { try { return $this->repository->with(['client', 'owner', 'notes'])->find($id); } catch (\Exception $e) { if (get_class($e) == 'Illuminate\\Database\\Eloquent\\ModelNotFoundException') { return ['error' => true, 'message' => 'Project does not exist' + $message]; } } }
public function show($id) { try { // return $this->repository->find($id); // return $this->repository->with(['owner', 'client'])->find($id); return $this->repository->with(['owner', 'client'])->find($id); } catch (Exception $e) { return ['error' => true, 'message' => $e->getMessage()]; } }
public function removeMember($id, $memberId) { try { //$user->roles()->detach($roleId); //$this->repository->find($id)->members()->detach($memberId); $this->repository->with(['members'])->find($id)->detach($memberId); return response()->json(['error' => false, 'message' => ['removeMember' => "Member ID {$memberId} removed"]]); } catch (ModelNotFoundException $ex) { return ['error' => true, 'message' => 'ID not found']; } }
public function destroy($id) { if (count(self::show($id)) == 0) { return ['error' => true, 'message' => 'Nao encontrado']; } else { if (count($this->repository->with(['project'])->findWhere(['id' => $id])) > 0) { return ['error' => true, 'message' => 'Este Cliente tem Projetos']; } else { return $this->repository->delete($id); } } }
/** * Display the specified resource. * * @param int $id * @return \Illuminate\Http\Response */ public function show($id) { try { if (!$this->service->checkProjectPermissions($id)) { return $this->erroMsgm("O usuário não tem acesso a esse projeto"); } return $this->repository->with(['owner', 'client'])->find($id); } catch (ModelNotFoundException $e) { return $this->erroMsgm('Projeto não encontrado.'); } catch (NoActiveAccessTokenException $e) { return $this->erroMsgm('Usuário não está logado.'); } catch (\Exception $e) { return $this->erroMsgm('Ocorreu um erro ao exibir o projeto.'); } }
public function showMembers($id) { try { return response()->json($this->repository->with(['members'])->find($id)); } catch (ModelNotFoundException $ex) { return $this->notFound($id); } }
public function isMember($id, $memberId) { try { return $this->repository->with(['members'])->find($id)->members()->get()->find($memberId) !== null; } catch (\Exception $e) { return ['error' => true, 'message' => 'An error occurred when trying to delete the data. Try again later.']; } }
/** * Display the specified resource. * * @param int $id * @return \Illuminate\Http\Response */ public function show($id) { //return $this->repository->find($id); //return $this->repository->with(['owner', 'client'])->find($id); //return['userId' => Authorizer::getResourceOwnerId()]; // $userId = Authorizer::getResourceOwnerId(); // // if ($this->repository->isOwner($id, $userId) == false) { // return ['success' => false]; // } try { //if ($this->checkProjectOwner($id) == false) { if ($this->checkProjectPermissions($id) == false) { return ['error' => 'Access forbidden']; } return $this->repository->with(['owner', 'client'])->find($id); } catch (ModelNotFoundException $e) { return ['error' => true, 'message' => 'Não foi possível exibir o projeto! Projeto não encontrado!']; } }
/** * Display a listing of the resource. * * @return Response */ public function index() { $this->repository->with('owner'); $this->repository->with('client'); return $this->repository->findWhere(['owner_id' => Authorizer::getResourceOwnerId()]); }
/** * Display a listing of the resource. * * @return \Illuminate\Http\Response */ public function index() { //return $this->repository->with(['owner','client'])->all(); return $this->repository->with(['owner', 'client'])->findWhere(['owner_id' => \Authorizer::getResourceOwnerId()]); //return $this->repository->all(); }
/** * Display a listing of the resource. * * @return Response */ public function index() { return $this->repository->with('owner')->with('client')->scopeQuery(function ($q) { return $q->where('owner_id', Authorizer::getResourceOwnerId())->orWhereRaw('EXISTS (SELECT 1 FROM project_members WHERE project_members.user_id = ' . Authorizer::getResourceOwnerId() . ' AND project_members.project_id = projects.id)'); })->all(); }
/** * Display a listing of the resource. * * @return Response */ public function index() { return $this->repository->with(['owner', 'client', 'notes', 'tasks', 'members'])->findWhere(['owner_id' => \Authorizer::getResourceOwnerId()]); }
/** * get a Project * * @param int $id * @return Entities\Project */ public function find($id) { return $this->repository->with(['owner', 'client'])->find($id); }
/** * Display a listing of the resource. * * @return \Illuminate\Http\Response */ public function index() { //return $this->repository->all(); return $this->repository->with(['owner', 'client'])->all(); }
/** * Display a listing of the resource. * * @return \Illuminate\Http\Response */ public function index() { return $this->repository->with('members')->all(); }