title: Use a dynamic URL in blade style barryvdh/laravel-dompdf
body: <p>I'm generating a PDF via: <a href="https://github.com/barryvdh/laravel-dompdf" rel="nofollow noreferrer">laravel-dompdf</a></p>
  
  <p>I can't seem to get the dynamic URLs to work. </p>
  
  <p><strong>Example:</strong></p>
  
  <p>Inside my blade file I have inline style setup like so and I need the background image to be a full path:</p>
  
  <pre><code>&lt;style&gt;
  .cardbg{
  background: url('https://examplesite.com/images/pic.jpg')
  }
  /* I've tried the following variations with no luck.
  I don't understand why this is not working. */
          background: url('{{asset('/images/pic.jpg')}}');
          background: url('{{public_path('/images/pic.jpg')}}');
          background: url('{{storage_path('/images/pic.jpg')}}');
          background: url('{{config('app.url').'/images/pic.jpg'}}');
  
  &lt;/style&gt;
  </code></pre>
  
  <p>Also added the direct path to a variable in my Controller like this:</p>
  
  <pre><code>    public function examplePdf($id){
          $pdfbg = config('app.url').'/images/pic.jpg';
  
          $pdf =  PDF::loadView('admin.dir.example-pdf', compact('pdfbg'))-&gt;setPaper('letter', 'landscape');
          return $pdf-&gt;stream('example.pdf');
  </code></pre>
  
  <p>Then call like this in blade <code>&lt;style&gt;</code>:</p>
  
  <pre><code>.cardbg{
  background: url('{{$pdfbg}}');
  }
  </code></pre>
  
  <p>Still nothing... Which doesn't make sense because when I do a <code>dd($pdfbg);</code> I get the correct path to the image. <code>"https://examplesite.com/images/pic.jpg"</code></p>
  
  <hr>
  
  <p>I did get the full path to render correctly Outside the <code>&lt;style&gt;</code> tags by doing this:</p>
  
  <pre><code>&lt;img  src="{{public_path("/storage/images/folder/$var-&gt;example/profile-img/$var-&gt;img_name")}}"&gt;
  </code></pre>
  
  <p>Any help would be appreciated.</p>