laravel get last index foreach collection code example
Example: blade loop last
$loop->last
@foreach ($colors as $k => $v)
@if($loop->last)
// at last loop, code here
@endif
@endforeach
$loop->last
@foreach ($colors as $k => $v)
@if($loop->last)
// at last loop, code here
@endif
@endforeach