application = $application;
        $this->cache = $cache;
        $this->filesystem = $filesystem->createLocalDriver(['root' => public_path()]);
    }
    /**
     * Modify a URL to append the asset hash.
     *
     * @param string $resource
     * @return string
     *
     * @throws \Illuminate\Contracts\Filesystem\FileNotFoundException
     */
    public function url(string $resource): string
    {
        $file = last(explode('/', $resource));
        $data = array_get($this->manifest(), $file, $file);
        return str_replace($file, array_get($data, 'src', $file), $resource);
    }
    /**
     * Return the data integrity hash for a resource.
     *
     * @param string $resource
     * @return string
     *
     * @throws \Illuminate\Contracts\Filesystem\FileNotFoundException
     */
    public function integrity(string $resource): string
    {
        $file = last(explode('/', $resource));
        $data = array_get($this->manifest(), $file, $file);
        return array_get($data, 'integrity', '');
    }
    /**
     * Return a built CSS import using the provided URL.
     *
     * @param string $resource
     * @return string
     *
     * @throws \Illuminate\Contracts\Filesystem\FileNotFoundException
     */
    public function css(string $resource): string
    {
        return '';
    }
    /**
     * Return a built JS import using the provided URL.
     *
     * @param string $resource
     * @return string
     *
     * @throws \Illuminate\Contracts\Filesystem\FileNotFoundException
     */
    public function js(string $resource): string
    {
        return '';
    }
    /**
     * Get the asset manifest and store it in the cache for quicker lookups.
     *
     * @return array
     *
     * @throws \Illuminate\Contracts\Filesystem\FileNotFoundException
     */
    protected function manifest(): array
    {
        if (! is_null(self::$manifest)) {
            return self::$manifest;
        }
        // Skip checking the cache if we are not in production.
        if ($this->application->environment() === 'production') {
            $stored = $this->cache->get('Core:AssetManifest');
            if (! is_null($stored)) {
                return self::$manifest = $stored;
            }
        }
        $contents = json_decode($this->filesystem->get(self::MANIFEST_PATH), true);
        $this->cache->put('Core:AssetManifest', $contents, 1440);
        return self::$manifest = $contents;
    }
}