I am new to Laravel.
I am trying to show the MySQL image in the background but I can’t.
I have used this code to show but it is not working at all
<div class=" banner-services-bg"style="background-image: url('{{ $pageData->image }}');">
I want to tell you that I can see $pagedata with the dd() function and the image is also there
and I have public>images folder structure
and also I can see my image directly on the page with this code
<img src="{{ url($pageData->image) }}"alt="" />
attributes i got through dd function
#attributes: [▼
"id" => 36
"title" => "Best Car Rental Offers"
"slug" => "car-rental"
"image" => "uploads/1/2023-03/car_with_driver.jpg"
]
2
Answers
I have used this code
and now i can see my database image as a background
thanks to all who reply on my post
There are two main resons!
div
has0
width and height!Try this: