Example #1
0
 /**
  * Remove old chunks
  */
 protected function removeOldData($filePath)
 {
     if ($this->storage->exists($filePath) && $this->storage->lastModified($filePath) < time() - $this->maxFileAge) {
         $this->storage->delete($filePath);
     }
 }
Example #2
0
 /**
  * Prepare public asset URL for filename-based cache busting.
  * More details https://github.com/h5bp/html5-boilerplate/blob/master/.htaccess
  *
  * @param  string  $file
  * @param  string  $url
  * @return string
  */
 function cache_buster($file)
 {
     $files = new \Illuminate\Filesystem\Filesystem();
     $path = rtrim(app()->basePath('public/'), '/') . DIRECTORY_SEPARATOR . $file;
     if ($files->exists($path)) {
         $filename = substr($file, 0, -strlen($files->extension($path)) - 1);
         $buster = $files->lastModified($path);
         $ext = $files->extension($path);
         return \Illuminate\Support\Facades\URL::to($filename . '.' . $buster . '.' . $ext);
     }
     throw new \Illuminate\Filesystem\FileNotFoundException("File does not exist at path {$path}");
 }