Skip to content

Instantly share code, notes, and snippets.

@cursosdesarrolloweb
Created August 1, 2021 10:41
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save cursosdesarrolloweb/7aa91976149122e961f701e684021054 to your computer and use it in GitHub Desktop.
Save cursosdesarrolloweb/7aa91976149122e961f701e684021054 to your computer and use it in GitHub Desktop.
<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