我想在旋转木马/滑块上显示与我页面上最后3个帖子相关的照片。
$last3
变量获得最后三个帖子:
<div class="row carousel-holder">
<div class="col-md-12">
<div id="carousel-example-generic" class="product carousel slide" data-ride="carousel">
<ol class="carousel-indicators">
<li data-target="#carousel-example-generic" data-slide-to="0" class="active"></li>
<li data-target="#carousel-example-generic" data-slide-to="1"></li>
<li data-target="#carousel-example-generic" data-slide-to="2"></li>
</ol>
<div class="carousel-inner">
@foreach($last3 as $post)
<div class="item active">
<div class="fill" style="background-image:url('../../images/Blog/{{$post->photo}}');"></div>
<h2><a href="post.html">{{$post->title}}</a></h2>
</div>
@endforeach
</div>
<a class="left carousel-control" href="#carousel-example-generic" data-slide="prev">
<span class="glyphicon glyphicon-chevron-left"></span>
</a>
<a class="right carousel-control" href="#carousel-example-generic" data-slide="next">
<span class="glyphicon glyphicon-chevron-right"></span>
</a>
</div>
</div>
</div>