I am iterating a foreach in my view to obtain some data, but can I add a css class to the last result?
@foreach ($mensajes as $item)
<li data-horizontal-timeline='{"date": "{{ $item->fecha }}"}'>
{{ $item->mensaje }}
</li>
@endforeach
To the last iteration I want to add this: class="selected"
Is it possible?
You can make use of the variable
$loop
that Laravel offers .