📜  如何在 laravel 中获取 foreach 中的第一项 - PHP 代码示例

📅  最后修改于: 2022-03-11 14:54:24.008000             🧑  作者: Mango

代码示例2
@foreach ($users as $user)
    @if ($loop->first)
        This is the first iteration.
    @endif

    @if ($loop->last)
        This is the last iteration.
    @endif

    

This is user {{ $user->id }}

@endforeach