/** * @return \Illuminate\Support\Collection */ protected function compileScriptMaterial() { $files = new Collection(); $this->layoutJsMaterial->merge($this->defaultJsMaterial)->merge($this->extendJsMaterial)->each(function ($value) use($files) { $files->push($this->findPath($value)); }); $code = md5($files); $this->dispatcher->listen('kernel.handled', function () use($code, $files) { $dictionary = new Collection(); $dictionary->push($this->application->publicPath()); $dictionary->push('cache'); $dictionary = $this->pathSplit($code, '2,2,2,2,2,2', $dictionary); $dictionary = $dictionary->implode(DIRECTORY_SEPARATOR); if (!$this->files->isDirectory($dictionary)) { $this->files->makeDirectory($dictionary, 0755, true, true); } $file = $dictionary . DIRECTORY_SEPARATOR . Str::substr($code, 12, 20) . '.js'; $key = 'cache.script.' . $code; if (!$this->files->exists($file) || !$this->cache->has($key) && $this->application->inDebugMode()) { $content = $this->compileScript($files); $expires = Carbon::now()->addMinutes(10); $this->cache->put($key, $content, $expires); file_put_contents($file, $content); } }); return $this->pathSplit($code, '2,2,2,2,2,2,20', Collection::make(['cache']))->implode('/') . '.js'; }
public function bootstrap(Application $app) { $this->app = $app; $this->fs = new Filesystem(); $paths = [$app->exportPath(), $app->homePath(), $app->storagePath(), $app->databasePath(), $app->publicPath(), $app->configPath()]; foreach ($paths as $path) { $this->ensureDirectory($path); } $storagePaths = ['app', 'framework', 'framework/cache', 'framework/views', 'framework/sessions', 'logs', $app->getSlug()]; foreach ($storagePaths as $path) { $this->ensureDirectory(path_join($app->storagePath(), $path)); } }
protected function publishAssets() { $this->filesystem->copyDirectory($this->application->basePath() . '/vendor/components/font-awesome/fonts', $this->application->publicPath() . '/assets/fonts'); }