laravel loop variable in controller 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