app/Module/ModuleCustomTrait.php
public function assetUrl(string $asset): string
    {
        $file = $this->resourcesFolder() . $asset;

        // Add the file's modification time to the URL, so we can set long expiry cache headers.
        $hash = filemtime($file);

        return route('module', [
            'module' => $this->name(),
            'action' => 'asset',
            'asset'  => $asset,
            'hash'   => $hash,
        ]);
    }
public function assetUrl(string $asset): string
    {
        $file = $this->resourcesFolder() . $asset;

        // Add the file's modification time to the URL, so we can set long expiry cache headers.
        $hash = filemtime($file);

        return route('module', [
            'module' => $this->name(),
            'action' => 'asset',
            'asset'  => $asset,
            'hash'   => $hash,
        ]);
    }
public function assetUrl ( string $ asset ) : string { $ file = $ this -> resourcesFolder ( ) . $ asset ; // Add the file's modification time to the URL, so we can set long expiry cache headers. $ hash = filemtime ( $ file ) ; return route ( 'module' , [ 'module' => $ this -> name ( ) , 'action' => 'asset' , 'asset' => $ asset , 'hash' => $ hash , ] ) ; }
Create a URL for an asset.

@param string $asset e.g. "css/theme.css" or "img/banner.png"

@return string
Create a URL for an asset .