title: Laravel cacheable images in the browser
body: <p>As a developer, I want to be in control of browser's cache. I don't want to just disable it.
  I like the way laravel <code>mix()</code> works. But how can I use it for images? 
  More specifically, for images that are being hardcoded in CSS files.
  Like</p>
  
  <pre><code>background-image: url('/my_image.png');
  </code></pre>
  
  <p>I know it is not quite a task for the 'mix()' function.</p>
  
  <p>Thus, I created some sort of a global variable (like a counter). If I change it (increment it once), all the cached images would be refreshed in the all of my clients' browsers.</p>
  
  <p>My idea was to make a route like this</p>
  
  <pre><code>Route::get('cacheable/1/images/{filename?}', [SomeController::class, 'get_image'])
    -&gt;where('filename', '.*')
    -&gt;name('cacheable.images');
  </code></pre>
  
  <p>and then I can call it like that</p>
  
  <pre><code>route('cacheable.images', 'smile.png');
  </code></pre>
  
  <p>I can change <code>1</code> to '2' and be sure, all the customer requests are now being pointed to a new route, and the images are found in a new route.</p>
  
  <p>But now I needed to hardcode images in the css files. And now I must not only change the url in the route file, but also go through all css in search of images. It breaks the idea of a single point of truth.
  And it breaks my heart.</p>
  
  <p>Any suggestion of how can I sync the <code>mix()</code> function and the 'Route::get' function?</p>