laravel loop variable
@foreach ($users as $user)
@if ($loop->first)
This is the first iteration.
@endif
@if ($loop->last)
This is the last iteration.
@endif
<p>This is user {{ $user->id }}</p>
@endforeach
laravel loop variable
@foreach ($users as $user)
@if ($loop->first)
This is the first iteration.
@endif
@if ($loop->last)
This is the last iteration.
@endif
<p>This is user {{ $user->id }}</p>
@endforeach
$loop variable laravel
<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>
Copyright © 2021 Codeinu
Forgot your account's password or having trouble logging into your Account? Don't worry, we'll help you to get back your account. Enter your email address and we'll send you a recovery link to reset your password. If you are experiencing problems resetting your password contact us