title: Laravel - using 'where' in routes.php to query a model
body: <p>I am looking to flatten my routes for an ecommerce store for SEO purposes.</p>
  
  <p>I would like to create the following routes:</p>
  
  <pre><code>Route::get('/{country}', ['uses' =&gt; 'Store\ProductController@browseCountry']);
  Route::get('/{category}, ['uses' =&gt; 'Store\ProductController@browseCategory']')
  </code></pre>
  
  <p>The <code>country</code> and <code>category</code> must be dynamic.</p>
  
  <p>I would like to know if something like the following is possible? and the best way of achieving.</p>
  
  <pre><code>// Route 1
  Route::get('/{country}', ['uses' =&gt; 'Store\ProductController@browseCountry'])
      -&gt;where('country', ProductCountry::select('slug')-&gt;get());
  
  // Route 2
  Route::get('/{category}', ['uses' =&gt; 'Store\ProductController@browseCategory'])
      -&gt;where('category', ProductCategory::select('slug')-&gt;get());
  </code></pre>
  
  <p>example routes:</p>
  
  <pre><code>/great-britain should be routed via Route 1
  /china         should be routed via Route 1
  
  /widgets       should fail route 1, but be routed via Route 2 because 
                 widgets are not in the product_country table but are in 
                 the product_category table
  </code></pre>
  
  <p>I know that I can hardcode my routes with possible countries:</p>
  
  <pre><code>Route::get('/{country}', ['uses' =&gt; 'Store\ProductController@browse'])
      -&gt;where('country', 'great-britain|china|japan|south-africa');
  </code></pre>
  
  <p>However this is clumsy and tedius. I would like to get the list of countries from the database.</p>