1<div>
2 @for ($i = 0; $i < $max; $i++) //Where $max is whatever you need as break condition.
3 <p>{{ $i }}</p> //This would print $i in a paragraph. You do whatever you need here.
4 @endfor
5</div>
1<ul>
2@foreach ($pages as $page)
3 <li>{{ $loop->iteration }}: {{ $page->title }}
4 @if ($page->hasChildren())
5 <ul>
6 @foreach ($page->children() as $child)
7 <li>{{ $loop->parent->iteration }}.{{ $loop->iteration }}:
8 {{ $child->title }}</li>
9 @endforeach
10 </ul>
11 @endif
12 </li>
13@endforeach
14</ul>
1Property Description
2$loop->index The index of the current loop iteration (starts at 0).
3$loop->iteration The current loop iteration (starts at 1).
4$loop->remaining The iterations remaining in the loop.
5$loop->count The total number of items in the array being iterated.
6$loop->first Whether this is the first iteration through the loop.
7$loop->last Whether this is the last iteration through the loop.
8$loop->even Whether this is an even iteration through the loop.
9$loop->odd Whether this is an odd iteration through the loop.
10$loop->depth The nesting level of the current loop.
11$loop->parent When in a nested loop, the parent's loop variable.