/**
  * Store a newly created resource in storage.
  *
  * @param  \Illuminate\Http\Request $request
  *
  * @return \Illuminate\Http\Response
  */
 public function store(Request $request)
 {
     $projectId = $request->exists('project_id') ? $request->get('project_id') : 0;
     if ($this->service->checkProjectPermissions($projectId) == false) {
         return ['error' => 'Access forbidden'];
     }
     return $this->service->addMember($request->all());
 }
 public function addMember($projectId, $memberId)
 {
     try {
         $this->checkPermissions($projectId);
         $this->service->addMember($projectId, $memberId);
     } catch (\Exception $e) {
         return ['error' => $e->getMessage()];
     }
 }
 /**
  * Add a project member
  * @param Request $request form request
  * @param integer  $id      project id
  * @return Response
  */
 public function addMember(Request $request, $id)
 {
     if (!$this->service->checkProjectPermissions($id)) {
         return ['error' => 'Access Forbidden'];
     }
     return $this->service->addMember($id, $request->get('user_id'));
 }
 /**
  * @param $id
  * @param $memberId
  * @return Response
  */
 public function addMember($id, $memberId)
 {
     if ($this->checkProjectPermissions($id) == false) {
         return ['error' => 'Access forbidden'];
     }
     return $this->service->addMember($id, $memberId);
 }
 public function addMember($project_id, $member_id)
 {
     try {
         return $this->service->addMember($project_id, $member_id);
     } catch (ModelNotFoundException $e) {
         return $this->erroMsgm('Projeto não encontrado.');
     } catch (QueryException $e) {
         return $this->erroMsgm('Cliente não encontrado.');
     } catch (\Exception $e) {
         return $this->erroMsgm('Ocorreu um erro ao inserir o membro.');
     }
 }
 public function addMember($project_id, $member_id)
 {
     try {
         if (!$this->service->checkProjectOwner($project_id)) {
             return $this->erroMsgm("O usuário não é owner desse projeto");
         }
         return $this->service->addMember($project_id, $member_id);
     } catch (ModelNotFoundException $e) {
         return $this->erroMsgm('Projeto não encontrado.');
     } catch (QueryException $e) {
         return $this->erroMsgm('Cliente não encontrado.');
     } catch (\Exception $e) {
         return $this->erroMsgm('Ocorreu um erro ao inserir o membro.');
     }
 }
 public function addMember(Request $request)
 {
     return $this->service->addMember($request->all());
 }
 /**
  * @param $id
  * @param $memberId
  * @return Response
  */
 public function addMember($id, $memberId)
 {
     return $this->service->addMember($id, $memberId);
 }
 /**
  * @param $projectId
  * @param $memberId
  * @return array
  */
 public function store($projectId, $memberId)
 {
     return $this->service->addMember($projectId, $memberId);
 }
Ejemplo n.º 10
0
 public function storeMember(Request $request, $project_id)
 {
     return $this->service->addMember($request->all(), $project_id);
 }
 public function addMember(Request $request, $projectId)
 {
     return $this->service->addMember($projectId, $request->get('user_id'));
 }