laravel foreach index key code example Example: loop index foreach laravel Click to copy@foreach ($teams as $key => $team) {{ str_ordinal($key + 1) }} @endforeach