title: Variable inside of asset declaration
body: <p>I am trying to randomise a background using Laravel. I pass the $background variable to the view and then try to load it as an inline style.</p>
  
  <p>However, I am struggling to declare the path to the asset and then call the variable together as it keeps erroring out.</p>
  
  <p>My current code is :</p>
  
  <pre><code>&lt;section class="page" style="background-image: url({{ asset('img/backgrounds/{{ $background }}.jpg') }});"&gt;
  </code></pre>
  
  <p>The $background is the variable and I am trying to reference the asset path.</p>
  
  <p>Is there a better / easier way to do this? Or how can I get this to work. Don't mind using PHP code as an alternative if needs be.</p>
  
  <p>Thanks</p>