Find last iteration of foreach loop in laravel blade : <p>In blade template i use last() method to find last iteration of foreach loop:</p>

<pre><code>@foreach ($colors as $k =&gt; $v)
   &lt;option value={!! $v-&gt;id !!} {{ $colors-&gt;last()-&gt;id==$v-&gt;id ? 'selected':'' }} &gt; {!! $v-&gt;name !!} &lt;/option&gt;
@endforeach
</code></pre>

<p>Is it ok? Perhaps there is a Laravel-style way to do the same?</p>
