title: simplify this @foreach/if in blade and laravel
body: <p>I am fairly new to laravel (L5 specifically) and I am making my own version of a todo app rather than following one of the tutorials out there. I've learned quite a bit so far but the way I have this piece of code currently laid out in my blade template makes me think their might be a simpler way of doing this.</p>
  
  <p>My <code>TodosController@index</code> fn is </p>
  
  <pre><code>public function index()
  {
      $todos = Todo::get();
      return view('todos', compact('todos'));
  }
  </code></pre>
  
  <p><code>App\Todo</code> extends an <code>Eloquent</code> model which makes data handling very easy!</p>
  
  <p>My route is:</p>
  
  <pre><code>Route::bind('todos', function($slug)
  {
      return App\Todo::whereSlug($slug)-&gt;first();
  });
  </code></pre>
  
  <p>So my page simply displays an unorded list of "todos". I want to have two separate lists. One that is for completed todos and one for incomplete. My blade template looks like this so far and looks a bit messy. Also I am looping over the results twice which is where I think I can improve on.</p>
  
  <pre><code>&lt;h3&gt;Incomplete&lt;/h3&gt;
  &lt;ul&gt;
      @foreach ($todos as $todo)
          @if ($todo-&gt;completed == 'No')
              &lt;li&gt;
                  &lt;a href="{{ route('todos.show', [$todo-&gt;slug]) }}"&gt;{{ $todo-&gt;title }}&lt;/a&gt;
              &lt;/li&gt;
          @endif
      @endforeach
  &lt;/ul&gt;
  
  &lt;h3&gt;Complete&lt;/h3&gt;
  &lt;ul&gt;
      @foreach ($todos as $todo)
          @if ($todo-&gt;completed == 'Yes')
              &lt;li&gt;
                  &lt;a href="{{ route('todos.show', [$todo-&gt;slug]) }}"&gt;{{ $todo-&gt;title }}&lt;/a&gt;
              &lt;/li&gt;
          @endif
      @endforeach
  &lt;/ul&gt;
  </code></pre>
  
  <p>Any suggestions to simplify that blade template?</p>