Find last iteration of foreach loop in laravel blade

后端 未结 5 1595
隐瞒了意图╮
隐瞒了意图╮ 2021-02-06 22:03

In blade template i use last() method to find last iteration of foreach loop:

@foreach ($colors as $k => $v)
   
5条回答
  •  南方客
    南方客 (楼主)
    2021-02-06 23:01

    Don't know if that last method is working but if not, try this:

    @foreach ($colors as $v)
    
    @endforeach
    

提交回复
热议问题