Forked from ijy/Laravel: Blade: Limit foreach loop.php
Created
April 8, 2019 19:39
-
-
Save mestanza/0e12f512d59e187cc76730f2ebd3fd9b to your computer and use it in GitHub Desktop.
A quick and easy way to limit a foreach loop in Laravel Blade.
This file contains 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_slice($posts->toArray(), 0, 5) as $post) | |
<h1>{{ $post['title'] }}</h1> | |
@endforeach |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment