public function create(array $data)
 {
     try {
         $this->validator->with($data)->passesOrFail();
         return $this->repository->create($data);
     } catch (ValidatorException $e) {
         return ['error' => true, 'message' => $e->getMessageBag()];
     }
 }
 public function create(array $data)
 {
     try {
         $this->validator->with($data)->passesOrFail();
         return $this->repository->create($data);
     } catch (ValidatorException $e) {
         return ['error' => true, 'message' => $e->getMessageBag()];
     } catch (QueryException $e) {
         return ['error' => true, 'message' => 'Não foi possível criar a tarefa. Projeto não existe!'];
     }
 }
 /**
  * @param array $data
  * @param $projectId
  * @return array|mixed
  */
 public function create(array $data, $projectId)
 {
     try {
         $data['project_id'] = $projectId;
         $this->validator->with($data)->passesOrFail();
         return $this->repository->create($data);
     } catch (ValidatorException $e) {
         return ['error' => true, 'message' => $e->getMessageBag()];
     } catch (\Exception $e) {
         return ["error" => true, "message" => $e->getMessage()];
     }
 }
 /**
  * @param array $data
  * @return mixed
  */
 public function create(array $data)
 {
     // enviar um email
     // disparar notificacao
     // postar um twett
     try {
         $this->validator->with($data)->passesOrFail();
         return $this->repository->create($data);
     } catch (ValidatorException $e) {
         return ['error' => true, 'message' => $e->getMessageBag()];
     }
 }
 /**
  * @param array $data
  * @return \Illuminate\Http\JsonResponse
  */
 public function create(array $data)
 {
     try {
         $this->validator->with($data)->passesOrFail(ValidatorInterface::RULE_CREATE);
         $create = $this->repository->create($data);
         $msg = "Tarefa criada com sucesso.";
         Log::info($msg);
         return response()->json(["message" => $msg, "data" => $create->toArray()], 200);
     } catch (ValidatorException $e) {
         return response()->json([$e->getMessageBag()], 400);
     }
     //QueryException tratado em Exceptions/Handler.php
 }
 public function create(array $data, $project_id)
 {
     // enviar email
     // disparar notificacao
     try {
         $data['project_id'] = $project_id;
         $this->validator->with($data)->passesOrFail(ValidatorInterface::RULE_CREATE);
         $rtrn = $this->repository->create($data);
         return $rtrn;
     } catch (Exception $e) {
         return ['error' => true, 'message' => $e->getMessageBag()];
     }
 }
 public function create(array $data)
 {
     try {
         $this->validator->with($data)->passesOrFail();
         $this->setPresenter();
         $result = $this->repository->create($data);
         event(new TaskWasIncluded($result));
         return $result;
     } catch (ValidatorException $e) {
         return ['error' => true, 'message' => $e->getMessageBag()];
     } catch (\Exception $e) {
         return ['error' => true, 'message' => $e->getMessage()];
     }
 }
 public function create(array $data)
 {
     try {
         $this->validator->with($data)->passesOrFail();
         if (is_null(Project::find($data['project_id']))) {
             return Errors::invalidId($data['project_id']);
         }
         $user_id = \Authorizer::getResourceOwnerId();
         if (!$this->projectRepository->isMember($data['project_id'], $user_id)) {
             return Errors::basic('Acesso negado. Você não é membro do projeto selecionado.');
         }
         return $this->repository->create($data);
     } catch (ValidatorException $e) {
         return Errors::basic($e->getMessageBag());
     }
 }
 public function addTask(Request $request)
 {
     try {
         return $this->taskRepository->create($request->all());
     } catch (ValidatorException $e) {
         $error = $e->getMessageBag();
         return ['error' => true, 'message' => "Erro ao cadastrar a tarefa, alguns campos são obrigatórios!", 'messages' => $error->getMessages()];
     } catch (\Exception $e) {
         return $this->erroMsgm('Ocorreu um erro ao cadastrar a tarefa.');
     }
 }