Finding the first item in a foreach?
<p>I am trying to add the class 'active' if tis the first item in a foreach but I keep getting a parse error? I am using Laravel and Blade, this is how I pass $members</p>

<pre><code>public function getView()
    {
        Cache::remember('members.members', 1, function() {
            return Player::orderBy('id', 'DESC')-&gt;where('display_member', '=', '1')-&gt;limit(10)-&gt;get();
        });

        return view('frontend.members')-&gt;withMembers(Cache::get('members.members'));
    }
</code></pre>

<blockquote>
  <p>Parse error: syntax error, unexpected 'endforeach' (T_ENDFOREACH),
  expecting elseif (T_ELSEIF) or else (T_ELSE) or endif (T_ENDIF)</p>
</blockquote>

<pre><code>&lt;div class="tab-content"&gt;
    @if ($members-&gt;count() &gt; 0)
        @foreach ($members as $key =&gt; $member)
        &lt;div role="tabpanel" class="tab-pane @if($members-&gt;first() == $member)active@endif" id="{{ $member-&gt;username }}"&gt;
            &lt;div class="col-md-12"&gt;
                &lt;h1&gt;{{ $member-&gt;username }}&lt;/h1&gt;
                &lt;br&gt;
                &lt;p&gt;Personal Website: &lt;a href="{{ $member-&gt;personal_website }}"&gt;{{ $member-&gt;personal_website }}&lt;/a&gt;&lt;/p&gt;
                &lt;p&gt;Last Login: 1st January, 2017&lt;/p&gt;
            &lt;/div&gt;
        &lt;/div&gt;
        @endforeach
    @endif
&lt;/div&gt;
</code></pre>