title: Access Laravel route from controller or pass parameter to controller from route
body: <p>I have four routes on my picture gallery app. They all do the same: query the database and render pictures. The only difference between them is the order of the records. For example:</p>
  
  <pre><code>http://example.com/favorites : shows pics ordered by favorites
  http://example.com/random    : shows pics ordered by random
  http://example.com/votes     : shows pics ordered by votes
  http://example.com/views     : shows pics ordered by views
  </code></pre>
  
  <p>For this, I want to use ONE action in my gallery controller and pass the order as a parameter.</p>
  
  <p>I know I can create this route:</p>
  
  <pre><code>Route::get('/{orderby}', 'GalleryController@showPics')
  </code></pre>
  
  <p>Then get the parameter from the controller:</p>
  
  <pre><code>class GalleryController extends BaseController
  {
      public function showPics($orderby)
      {
          //query model ordering by $orderby and render the view
      }
  }
  </code></pre>
  
  <p>The problem is I don't want to capture example.com/whatever, only those four specific routes. </p>
  
  <p>Is it there a way to pass a parameter to a controller action from the route. Or, alternatively, to read the current accessed route from the controller?</p>