1

I'm facing a problem i don't really understand it. I'm using Laravel 8 jobs to save my blade view as an html page in my public folder. In my main view I have to load another view and pass it a path to the image which stored in the public folder as follows:

@php            
    $path = $book->image;
    //dd($path)
@endphp                                                                                                
@component('report/sales', ['path' => $path])
@endcomponent

the $path variable here contains something like http://localhost/myapp/src/public/images/books/xyz.jpg In this view if i do dd($path) I get the http://localhost/myapp/src/public/images/books/xyz.jpg as expected. Now in sales view I do this:

<img src= "{{ asset("/" . $path) }}" alt="some text" width="50%">

Now in the produced html file the image is not loaded and src property has the value http://localhost/myapp/src/public The strange thing is that when I don't use jobs the html file has this picture. Another weird thing, if I hardcode the value of the variable $path in my main view as:

@php            
    $path = "http://localhost/myapp/src/public/images/books/xyz.jpg";
@endphp                                                                                                
@component('report/sales', ['path' => $path])
@endcomponent

And I use it with jobs the html file is produced with the picture and everything is fine. Could somebody please help me to understand? Thanks.

miken32
  • 42,008
  • 16
  • 111
  • 154
somnso
  • 37
  • 5

0 Answers0