-
-
Save msurguy/9401567 to your computer and use it in GitHub Desktop.
Using array_chunk to wrap a number of DOM elements in another DOM element such as a div
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@foreach(array_chunk($posts, 3) as $postSet) | |
<div class="row"> <!-- this div will surround every three posts --> | |
@foreach($postSet as $post) | |
<h3>{{ $post['title'] }}</h3> | |
@endforeach | |
</div> | |
@endforeach |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment