Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
<div>
<h2>foreach</h2>
@foreach($users as $user)
<p>
Index: {{ $loop->index }} | Is odd: {{ $loop->odd }} | Is even: {{ $loop->even }} | Count: {{ $loop->count }} |
Remaining: {{ $loop->remaining }} | Iteration: {{ $loop->iteration }} | Last: {{ $loop->last }}
</p>
@endforeach
<h2>forelse</h2>
@forelse($users as $user)
<p>
Index: {{ $loop->index }} | Is odd: {{ $loop->odd }} | Is even: {{ $loop->even }} | Count: {{ $loop->count }} |
Remaining: {{ $loop->remaining }} | Iteration: {{ $loop->iteration }} | Last: {{ $loop->last }}
</p>
@empty
@endforelse
</div>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment