An image

Corporate Blogs

Professional Life of an IT Consultant Interview with Valentin Crettaz
Written by

Thoughts on

There is easy way to do it,
1. create new static function on you own helper
public static function getAutoVersion($file)
$filePath = public_path() . DS . $file;
if (!file_exists($filePath)) {
return ”;
$version = filemtime($filePath);
return ‘?v=’ . $version;
2. call this function on laravel core helper asset (for laravel version 5 or above)
path /vendor/laravel/framework/src/Illuminate/Foundation/helpers.php
assume that Webapp is your helper class
if (! function_exists(‘asset’)) {
* Generate an asset path for the application.
* @param string $path
* @param bool $secure
* @return string
function asset($path, $secure = null)
return app(‘url’)->asset($path, $secure) . Webapp::getAutoVersion($path);

Leave a Comment

You have an Idea. We have the Solution.

We help business evolve with lates technologies and infrastructures tailored to their needs and market trends.