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()]; } }
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()]; } }
public function checkProjectMember($projectId) { $userId = \Authorizer::getResourceOwnerId(); return $this->repository->hasMember($projectId, $userId); }