laravellaravel-5.7voyager

In voyager admin panel how to solve directory separator issue


I have created a page in the voyager admin panel, but when I tried to retrieve in view the path of the image is like

http://localhost:8000/storage/pages\October2019\eltiRUSN1BArKdXi4uyl.png

you noticed that the first forward slash and then next backward slash, so that's why an image is not displaying in view.

I used this code to print an image.

<div class="header_bg" style="background-image: url('{{ url("storage/$page_data->image") }}');"></div>

Solution

  • The answer is, this image is set by voyage admin so I have use voyager language.

    <div class="header_bg" style="background-image: url('{{Voyager::image($page_data->image)}}');"></div>
    

    to the print image which set from voyager in blade view use this syntax

    {{Voyager::image($page_data->image)}}