laravel check foreach loop index odd code example
Example 1: loop index foreach laravel
@foreach ($teams as $key => $team)
{{ str_ordinal($key + 1) }}
@endforeach
Example 2: laravel foreach loop index
@foreach ($items as $item)
{{ $loop->index }}
@endforeach