how to use for foreach loop in carousel in laravel blade

Solutions on MaxInterview for how to use for foreach loop in carousel in laravel blade by the best coders in the world

showing results for - "how to use for foreach loop in carousel in laravel blade"
Emma
18 Jul 2019
1<div id="carouselExampleControls" class="carousel slide" data-ride="carousel">
2
3  <ol class="carousel-indicators">
4   @foreach( $photos as $photo )
5      <li data-target="#carouselExampleIndicators" data-slide-to="{{ $loop->index }}" class="{{ $loop->first ? 'active' : '' }}"></li>
6   @endforeach
7  </ol>
8
9  <div class="carousel-inner" role="listbox">
10    @foreach( $photos as $photo )
11       <div class="carousel-item {{ $loop->first ? 'active' : '' }}">
12           <img class="d-block img-fluid" src="{{ $photo->image }}" alt="{{ $photo->title }}">
13              <div class="carousel-caption d-none d-md-block">
14                 <h3>{{ $photo->title }}</h3>
15                 <p>{{ $photo->descriptoin }}</p>
16              </div>
17       </div>
18    @endforeach
19  </div>
20  <a class="carousel-control-prev" href="#carouselExampleControls" role="button" data-slide="prev">
21    <span class="carousel-control-prev-icon" aria-hidden="true"></span>
22    <span class="sr-only">Previous</span>
23  </a>
24  <a class="carousel-control-next" href="#carouselExampleControls" role="button" data-slide="next">
25    <span class="carousel-control-next-icon" aria-hidden="true"></span>
26    <span class="sr-only">Next</span>
27  </a>
28</div>