laravel for i code example
Example 1: use if in laravel blade
@if($user->status =='active')
<td>{{ $user->name }}</td>
@else
<td> Guest </td>
@endif
Example 2: $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>