title: how laravel blade to merge request segment into url router in layout?
body: <p><em>I'm develop in Laravel, with Router, Request, Blade (I think that's all related)</em></p>
  
  <h2>I need product filter menu at layout.blade.php</h2>
  
  <p>It does filter and menu like below</p>
  
  <pre><code>locations &gt; east, west, south, north
  category &gt; shop, f&amp;b, services
  is_new &gt; new, all
  </code></pre>
  
  <p>So then I make the the router as below</p>
  
  <pre><code>Route::get('/at/{location_id?}/{location?}/{category_id?}/{category?}/{is_new?}',array('as'=&gt;'deals','uses'=&gt;'HomeController@index'));
  </code></pre>
  
  <h2>Current solution on my menu</h2>
  
  <p>I need a menu in layout.blade.php and generate url based on the user selected location, category, is_new. and this layout used for other actions as well.</p>
  
  <p>I don't know how to do these logic on layout. and the solution I got at the end kinda trick.</p>
  
  <pre><code>      &lt;ul id='nav-category' class="dropdown-menu extended"&gt;
          @if (Request::segment(1)=='deals')
            @foreach (Deal::$categories as $category)
              &lt;li&gt;&lt;a href='{{route("deals",array("location_id"=&gt;Request::segment(3),"location"=&gt;Request::segment(4),"category_id"=&gt;$category["id"],"category"=&gt;Str::slug($category["title"])))}}'&gt;{{$category['title']}}&lt;/a&gt;&lt;/li&gt;
            @endforeach
          @else
            @foreach (Deal::$categories as $category)
              &lt;li&gt;&lt;a href='{{route("deals",array("location_id"=&gt;"all","category_id"=&gt;$category["id"],"category"=&gt;Str::slug($category["title"])))}}'&gt;{{$category['title']}}&lt;/a&gt;&lt;/li&gt;
            @endforeach
          @endif
        &lt;/ul&gt;
  </code></pre>
  
  <h2>Problem</h2>
  
  <ul>
  <li>using Request::segment to get the state don't seem very right</li>
  <li>may have more conditions come in and mess up the blade</li>
  </ul>
  
  <p>This is should be a common problem, but somehow I can't find a good practice. Any suggestion?</p>