i just want to put the name of the slider image inside foreach loop and all of it is inside css "backgound:image:url()" i want to write the php code inside background-image like css
background-image: url({{url('sliderimages/'.$slider->slider)}});
it dosn't display images
i when i am using asset it didn't work i don't know why please help
here is my foreach blade code
<div >
<!-- ========================================== SECTION – HERO ========================================= -->
@foreach ($sliders as $slider)
<div id="hero">
<div id="owl-main" >
<div style="background-image: url(asset('sliderimages/'$slider->slider));">
<div >
<div >
<div >{{$slider->title}}</div>
<div > New Collections </div>
<div > <span>{{$slider->description}}</span> </div>
<div > <a href="index.php?page=single-product" >Shop Now</a> </div>
</div>
<!-- /.caption -->
</div>
<!-- /.container-fluid -->
</div>
<!-- /.item -->
@endforeach
<!-- /.item -->
</div>
<!-- /.owl-carousel -->
</div>
CodePudding user response:
If it's in public styles folder:
background-image: url("{{ asset('sliderimages/'.$slider->slider) }}");
in other pathes:
background-image: url("{{url('sliderimages/'.$slider->slider)}}");