dimanche 24 septembre 2017

Laravel 5.4 checking if chunk is first chunk

I'm trying to set a condition check whether the chunk is the first batch of chunk or not.

Anyone know how to check what the chunk id or something similar for example:

@foreach($item->chunk(3) as $item_chunk
    @if(chunk is first chunk)
        <div class="carousel-item active">
    @else
        <div class="carousel-item">
    @endif

    @foreach($item_chunk as $item)
        
    @endforeach 
@endforeach

Appreciate it if someone knows of a way to check whether the chunked list is first or not.



from Newest questions tagged laravel-5 - Stack Overflow http://ift.tt/2hs0OfU
via IFTTT

Aucun commentaire:

Enregistrer un commentaire