I have a view with the following loops
@foreach ($displayRooms as $room => $events)
@foreach ($events as $event)
@include('partials.event', ['event' => $event, 'room' => $room, 'active' => $loop->first])
@endforeach
@endforeach
Then i have the following partial view with the following code
<div class="carousel-item ">
<div class="card text-center">
<h3 class="card-header">Happening </h3>
<div class="card-block">
<ul>
<li><h3 class="card-title"></h3></li>
@if (empty($event))
<li><h3 class="card-title"></h3></li>
@else
@if ($event->available)
<li><h3 class="card-title"></h3></li>
@else
<li><h3 class="card-title"></h3></li>
<li><h3 class="card-title"> - </h3></li>
<li><h3 class="card-title"> - </h3></li>
@endif
@endif
</ul>
</div>
</div>
</div>
What i need is the following
<div class="carousel-item ">
In order to se the class of active to a carousel item, it has to be the first iteration from the above loop.
How could I go about obtaining the first loop index so that I may set it inside of the @include.
Make sense?
via Zach Tackett