How to find the last item in the foreach loop if Im using @if inside the foreach, I want to find it so I want to remove the dot after the last item, I want these dots to be shown only between items like: hello . Help . I know the way using loop-->last, but it doesnt work becuase the @if conditon shows different last item, which means if we have 100 items but when we use if it will show let say the item 1 and 42 and 63 so the last item here is 63 but when use loop->last will show that last item is 100
Here but what I have is like this: Here.
@foreach($cuisines as $cuisine)
@if(($cuisine->id)==($scuitem->cuisine_id))
{{ $cuisine->title }} •
@endif
@endforeach
$end = end($cuisines)before loop and match with$end->cuisine_id == $cuisine->idinside loop