<div> @for ($i = 0; $i < $max; $i++) //Where $max is whatever you need as break condition. <p>{{ $i }}</p> //This would print $i in a paragraph. You do whatever you need here. @endfor </div>
<ul> @foreach ($pages as $page) <li>{{ $loop->iteration }}: {{ $page->title }} @if ($page->hasChildren()) <ul> @foreach ($page->children() as $child) <li>{{ $loop->parent->iteration }}.{{ $loop->iteration }}: {{ $child->title }}</li> @endforeach </ul> @endif </li> @endforeach </ul>