public function members($id) { //return $this->repository->findWhere(['project_id' => $id, 'id' => $noteId]); //return $this->repository->find($id); //return $this->repository->with(['members'])->find($id); return $this->repository->with(['user'])->findWhere(['project_id' => $id]); }
public function delete($id) { if (is_null(ProjectMember::find($id))) { return Errors::invalidId($id); } $this->repository->delete($id); return ['message' => "Registro deletado!"]; }
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($id_project, $id_user) { $is = $this->repository->findWhere(['project_id' => $id_project, 'user_id' => $id_user]); if (count($is) > 0) { return 'true'; } return 'false'; }
public function destroy($id, $idProjectMember) { try { return ['success' => $this->repository->delete($idProjectMember)]; } catch (ModelNotFoundException $e) { return response()->json(['Erro' => '1', 'Mensagem' => 'Registro nao localizado']); } }
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 }
public function update(array $data, $id) { try { $this->validator->with($data)->passesOrFail(); return $this->repository->update($data, $id); } catch (ValidatorException $e) { return ['error' => true, 'message' => $e->getMessageBag()]; } }
public function destroy($id, $taskId) { if (count(self::show($id, $taskId)) == 0) { return ['error' => true, 'message' => 'Nao encontrado']; } else { $this->repository->delete($taskId); return ['error' => true, 'message' => 'Nota ' . $taskId . ' do Projeto Excluido']; } }
public function delete($id) { try { if ($this->repository->delete($id)) { return ['success' => true, 'message' => 'Tarefa apagado com sucesso!']; } } catch (ModelNotFoundException $e) { return ['error' => true, 'message' => 'Não foi possível apagar o membro! Projeto ou membro não encontrado!']; } }
public function delete($id) { try { if ($this->repository->delete($id)) { return ['error' => false, 'message' => 'Registro deletado com sucesso.']; } } catch (\Exception $e) { return ['error' => true, 'message' => 'Não foi possivel deletar o registro.']; } }
public function getMember($projectId, $id) { try { $data = $this->memberRepository->setPresenter($this->memberPresenter)->findWhere(['project_id' => $projectId, 'member_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()]; } }
public function delete($id) { $pm = ProjectMember::find($id); if (is_null($pm)) { return Errors::invalidId($id); } // Lembrete: a verificacao se o usuario autenticado eh o dono do projeto ja foi // feita via middleware. Basta agora testar se o membro nao eh o usuario autenticado $user_id = \Authorizer::getResourceOwnerId(); if ($user_id == $pm->user_id) { return Errors::basic("Voce eh dono do projeto e portanto nao pode se excluir dele"); } $this->repository->delete($id); return ['message' => "Registro deletado!"]; }
public function create(array $data) { // enviar email // disparar notificacao // postar tweet try { $this->validator->with($data)->passesOrFail(); $project = $this->repository->create($data); //Adiciona o owner como membro $this->project_member_repository->create(['project_id' => $project['data']['id'], 'user_id' => $project['data']['owner_id']]); return $project; } catch (ValidatorException $e) { return ['error' => true, 'message' => $e->getMessageBag()]; } }
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 allMember($limit) { $user_id = \Authorizer::getResourceOwnerId(); $ids = $this->projectMemberRepository->projectsOfWhichIsMember($user_id); return $this->repository->findMember($ids, $limit); }
public function checkProjectMember($projectId) { $userId = \Authorizer::getResourceOwnerId(); return $this->memberRepository->isMember($projectId, $userId); }
/** * Remove the specified resource from storage. * * @param int $id * @param $memberId * @return \Illuminate\Http\Response */ public function destroy($id, $memberId) { $this->repository->delete($memberId); }
public function all() { $user_id = \Authorizer::getResourceOwnerId(); $ids = $this->projectMemberRepository->projectsOfWhichIsMember($user_id); return $this->repository->with(['client', 'owner'])->findWhereIn('id', $ids); }
private function setPresenter() { $this->repository->setPresenter('CodeProject\\Presenters\\ProjectMemberPresenter'); }
public function isMember($id, $memberId) { return $this->repository->isMember($id, $memberId); }
public function delete($id) { $projectMember = $this->repository->skipPresenter()->find($id); return $projectMember->delete(); }
/** * Display a listing of the resource * * @param $id * @return Response */ public function index($id) { return $this->repository->findWhere(['project_id' => $id]); }
public function members($projectId) { return $this->projectMemberRepository->skipPresenter()->findWhere(['project_id' => $projectId]); }
public function show($id, $idProjectMember) { return $this->repository->find($idProjectMember); }
/** * Remove the specified resource from storage. * * @param int $id * @return Response */ public function destroy($id) { if ($this->repository->delete($id)) { return ['success' => true]; } }