Пример #1
0
 public function getPackageWithVersion($identifier, $versionNumber)
 {
     $package = Package::withIdentifier($identifier);
     if (!$package) {
         abort(404);
     }
     $version = null;
     foreach ($package->versions as $v) {
         if ($v->isVersion($versionNumber)) {
             $version = $v;
             break;
         }
     }
     if (!$version) {
         abort(404);
     }
     if (!file_exists($version->storagePath)) {
         abort(404);
     }
     return response()->download($version->storagePath, $identifier . '.tar');
 }
Пример #2
0
 /**
  * Retrieves the stored package with the given identifier or creates a new one.
  * 
  * @param string $identifier The identifier for the package to be retrieved
  * @return Package
  */
 protected function buildPackage()
 {
     $package = Package::withIdentifier($this->identifier);
     if (!$package) {
         $package = new Package(['identifier' => $this->identifier]);
     }
     return $package;
 }