src/Platform/Http/Controllers/Systems/ResourceController.php
public function show(string $package, string $path, Dashboard $dashboard)
    {
        $dir = $dashboard
            ->getPublicDirectory()
            ->get($package);

        abort_if(is_null($dir), 404);

        $resources = (new Finder())
            ->ignoreUnreadableDirs()
            ->followLinks()
            ->in($dir)
            ->files()
            ->path(dirname($path))
            ->name(basename($path));

        $iterator = tap($resources->getIterator())
            ->rewind();

        $this->resource = $iterator->current();

        abort_if(is_null($this->resource), 404);

        $mime = new MimeTypes();
        $mime = $mime->getMimeType($this->resource->getExtension());

        return response()->file($this->resource->getRealPath(), [
            'Content-Type'  => $mime ?? 'text/plain',
            'Cache-Control' => 'public, max-age=31536000',
        ]);
    }
public function show(string $package, string $path, Dashboard $dashboard)
    {
        $dir = $dashboard
            ->getPublicDirectory()
            ->get($package);

        abort_if(is_null($dir), 404);

        $resources = (new Finder())
            ->ignoreUnreadableDirs()
            ->followLinks()
            ->in($dir)
            ->files()
            ->path(dirname($path))
            ->name(basename($path));

        $iterator = tap($resources->getIterator())
            ->rewind();

        $this->resource = $iterator->current();

        abort_if(is_null($this->resource), 404);

        $mime = new MimeTypes();
        $mime = $mime->getMimeType($this->resource->getExtension());

        return response()->file($this->resource->getRealPath(), [
            'Content-Type'  => $mime ?? 'text/plain',
            'Cache-Control' => 'public, max-age=31536000',
        ]);
    }
public function show ( string $ package , string $ path , Dashboard $ dashboard ) { $ dir = $ dashboard -> getPublicDirectory ( ) -> get ( $ package ) ; abort_if ( is_null ( $ dir ) , 404 ) ; $ resources = ( new Finder ( ) ) -> ignoreUnreadableDirs ( ) -> followLinks ( ) -> in ( $ dir ) -> files ( ) -> path ( dirname ( $ path ) ) -> name ( basename ( $ path ) ) ; $ iterator = tap ( $ resources -> getIterator ( ) ) -> rewind ( ) ; $ this -> resource = $ iterator -> current ( ) ; abort_if ( is_null ( $ this -> resource ) , 404 ) ; $ mime = new MimeTypes ( ) ; $ mime = $ mime -> getMimeType ( $ this -> resource -> getExtension ( ) ) ; return response ( ) -> file ( $ this -> resource -> getRealPath ( ) , [ 'Content-Type' => $ mime ?? 'text/plain' , 'Cache-Control' => 'public, max-age=31536000' , ] ) ; }
Serve the requested resource.

@param string    $package
@param string    $path
@param Dashboard $dashboard

@return \Symfony\Component\HttpFoundation\BinaryFileResponse
Serve the requested resource .