title: ElseIf statement with laravel
body: <p>I have the following foreach loop that I'm getting good results with however when it gets to the elseif statement I'm attempting to see if two of the players are on the same team or not and if they are then have them listed together separated with a &amp; symbol. Currently I am getting the following still. </p>
  
  <pre><code>Player 1 vs. Player 2 vs. Player 3 vs. Player 4
  </code></pre>
  
  <p>This is okay however Player 1 and Player 2 are on the same team. So its not seeing them as on the same team for some reason. Does someone see what my issue is?</p>
  
  <pre><code>@foreach ($match-&gt;players AS $key =&gt; $player)
      @foreach ($player-&gt;list as $member)
          {{ $member-&gt;player_name }}
      @endforeach
      @if($match-&gt;players-&gt;count() - 1 != $key)
          vs.
      @elseif ($match-&gt;players[$key - 1]-&gt;team_id == $player-&gt;team_id)
          &amp;
      @endif
  @endforeach 
  </code></pre>
  
  <p>EDIT: I changed the data a little but still should work.</p>
  
  <pre><code>http://pastebin.com/AdyzemC4
  </code></pre>