title: laravel sorting in view
body: <p>i'm using laravel 4.1 and i am stuck in a repeatitive task.
  to sort the index of people i do this:</p>
  
  <pre><code>$sort = (!is_null(Input::get('sort')) ? Input::get('sort') : 'lastname'); 
  //with 'lastname' being the default column to sort on.
  $order = (!is_null(Input::get('order')) ? Input::get('order') : 'asc');
  //'desc' is the default sort order.
  $people = $people-&gt;orderBy($sort, $order);
  $people = $people-&gt;paginate(20);
  return View::make('people.index', array('people' =&gt; $people, 'sort' =&gt; $sort, 'order' =&gt; $order));
  </code></pre>
  
  <p>in the view self i create the links to sort with this snippet, which also works fine</p>
  
  <pre><code>&lt;th&gt;{{link_to_route(Route::currentRouteName(),'Lastname', array('sort' =&gt; 'lastname'))}}
  @if ($order != 'asc')
    &lt;a href="{{URL::route(Route::currentRouteName(), array('sort' =&gt; $sort, 'order' =&gt; 'asc'))}}"&gt;
      &lt;i class="fa fa-sort-asc "&gt;&lt;/i&gt;
    &lt;/a&gt;
  @else
    &lt;a href="{{URL::route(Route::currentRouteName(), array('sort' =&gt; $sort, 'order' =&gt; 'desc'))}}"&gt;
      &lt;i class="fa fa-sort-desc "&gt;&lt;/i&gt;
    &lt;/a&gt;
  @endif&lt;/th&gt;
  </code></pre>
  
  <p>The problem i have is tha i want to sort multiple columns. My question is: Do i have to copy the down part in every head column? or can i put the part somewhere so i can use it with a simplier call ?</p>
  
  <p>thanks</p>