public function createFile($request)
 {
     $project = $this->repository->skipPresenter()->find($request->project_id);
     $file = $request->file('file');
     $extension = $file->getClientOriginalExtension();
     $projectFile = $project->files()->create(['name' => $request->name, 'extension' => $extension, 'description' => $request->description, 'project_id' => $request->project_id]);
     $this->storage->put($projectFile->id . '.' . $extension, $this->file->get($file));
 }
 public function checkPermissions($projectId)
 {
     $owner = $this->project->find($projectId)->owner_id;
     $userId = Authorizer::getResourceOwnerId();
     if ($owner != $userId and !$this->hasMember($projectId)) {
         throw new \Exception('Access Denied');
     }
     return true;
 }
 public function checkPermissions($projectId)
 {
     $userId = Authorizer::getResourceOwnerId();
     if (!$this->repository->isOwner($projectId, $userId) and !$this->repository->hasMember($projectId, $userId)) {
         throw new \Exception('Access Forbiden');
     }
     return true;
 }
 public function index()
 {
     return $this->repository->all();
 }
 public function index($projectId)
 {
     $project = $this->project->find($projectId);
     return $project->tasks;
 }