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]);
 }
 public function delete($id, $memberId)
 {
     try {
         $this->repository->findWhere(['project_id' => $id, 'member_id' => $memberId])[0]->delete();
     } catch (\Exception $e) {
         return ['error' => true, 'message' => $e->getMessage()];
     }
 }
 public function isMember($id_project, $id_user)
 {
     $is = $this->repository->findWhere(['project_id' => $id_project, 'user_id' => $id_user]);
     if (count($is) > 0) {
         return 'true';
     }
     return 'false';
 }
 /**
  * Display the specified resource.
  *
  * @param  int $id
  * @param $memberId
  * @return \Illuminate\Http\Response
  */
 public function show($id, $memberId)
 {
     $projectMember = $this->repository->findWhere(['project_id' => $id, 'user_id' => $memberId])->first();
     if (count($projectMember) == null) {
         return ['error' => true, 'message' => "Membro {$memberId} não encontrado no Projeto {$id}"];
     }
     return $projectMember;
 }
Exemplo n.º 5
0
 public function isMember($project_id, $user_id)
 {
     $result = $this->repositoryMember->findWhere(['project_id' => $project_id, 'user_id' => $user_id]);
     if (count($result) > 0) {
         return true;
     }
     return false;
 }
 public function isMember($projectId, $memberId)
 {
     try {
         return $this->repository->findWhere(['project_id' => $projectId, 'user_id' => $memberId])->isEmpty();
     } catch (ModelNotFoundException $e) {
         return false;
     }
     //QueryException tratado em Exceptions/Handler.php
 }
Exemplo n.º 7
0
 public function isMember($id, $id_user)
 {
     $data = $this->repositoryProjectMember->findWhere(['project_id' => $id, 'user_id' => $id_user])->all();
     if ($data) {
         return ['message' => 'User is already member of the project'];
     } else {
         return ['message' => 'User is not member of the project'];
     }
 }
 public function index($id)
 {
     return $this->repository->findWhere(['project_id' => $id]);
 }
 public function show($id, $taskId)
 {
     return $this->repository->findWhere(['project_id' => $id, 'id' => $taskId]);
 }