Skip to content Skip to sidebar Skip to footer

Laravel Twitter Bootstrap: Showing Data On Views

I am showing data to views where i have the following layout, And i have to use that layout. I am querying my DB like this : $entertainments = App\TalentTag::all()->random(5);

Solution 1:

The $entertainments variable that you get is a Collection, so you can use the method chunk() on it. It splits the Collection into smaller ones. Read about it here.

@foreach ($products->chunk(3) as $chunk)
    <div class="row">
        @foreach ($chunk as $product)
            <div class="col-xs-4">{{ $product->name }}</div>
        @endforeach
    </div>
@endforeach

Post a Comment for "Laravel Twitter Bootstrap: Showing Data On Views"