blade loop variable in laravel code example
Example: $loop variable laravel
@foreach ($pages as $page)
- {{ $loop->iteration }}: {{ $page->title }}
@if ($page->hasChildren())
@foreach ($page->children() as $child)
- {{ $loop->parent->iteration }}.{{ $loop->iteration }}:
{{ $child->title }}
@endforeach
@endif
@endforeach