Пример #1
0
 public function create(array $data)
 {
     try {
         $this->validator->with($data)->passesOrFail();
         $project = $this->projectRepositories->skipPresenter()->find($data['project_id']);
         $projectTask = $project->tasks()->create($data);
         return $projectTask;
     } catch (ValidatorException $e) {
         return ['error' => true, 'message' => $e->getMessageBag()];
     }
 }
Пример #2
0
 public function create(array $data)
 {
     try {
         $this->validator->with($data)->passesOrFail(ValidatorInterface::RULE_CREATE);
         $project = $this->projectRepositories->skipPresenter()->find($data['project_id']);
         $projectFile = $project->files()->create($data);
         $this->storage->put($projectFile->getFileName(), $this->filesystem->get($data['file']));
         return $projectFile;
     } catch (ValidatorException $e) {
         return ['error' => true, 'message' => $e->getMessageBag()];
     }
 }
Пример #3
0
 public function checkProjectMember($projectId)
 {
     $userId = \Authorizer::getResourceOwnerId();
     return $this->repository->hasMember($projectId, $userId);
 }