title: Can I add a parameter to a Route::group in Laravel but remove it before dispatching to a route in Laravel?
body: <p>I am using Laravel 4 to create APIs namespaced by <code>accountname</code> of each of my customers.  Each customer has their own, identical database.  So Foocorp should make api calls that look like this:</p>
  
  <blockquote>
    <p><a href="http://api.example.com/Foocorp/users/5" rel="nofollow">http://api.example.com/Foocorp/users/5</a></p>
  </blockquote>
  
  <p>Barcorp api calls look like this</p>
  
  <blockquote>
    <p><a href="http://api.example.com/Barcorp/users/5" rel="nofollow">http://api.example.com/Barcorp/users/5</a></p>
  </blockquote>
  
  <p>I must include the account name in the URL for business/branding reasons, so I cannot eliminate this parameter from the URL routes.</p>
  
  <p>Here is a filter that I was using to attempt to pull out the account name from the route, verify it is active, and point to their database.  I hoped to remove the <code>accountname</code> parameter so that I could write all my controller functions to not include an <code>$accountname</code> parameter for all of them.</p>
  
  <pre><code>Route::filter('accountverification', function()
  {
      $route = Route::getCurrentRoute();
      $params = $route-&gt;getParameters();
      $accountName = $params['accountname'];
  
      // verify account with this name exists and set up DB connection to point to their database
      // ...
  
      unset($params['accountname']);
      $route-&gt;setParameters($params);
  });
  </code></pre>
  
  <p>Here's my route group that uses the filter:</p>
  
  <pre><code>Route::group(array('prefix' =&gt; '{accountname}', 'before' =&gt; 'accountverification'), function() {
      Route::get('users/{id}', 'UsersController@getShow')
          -&gt;where(array('id' =&gt; '[0-9]+'));
  });
  </code></pre>
  
  <p>The problem is that removing the parameter in the filter does not have any effect when controller/function is called.  In the UsersController::getShow function the first parameter is always the <code>accountname</code> from the group prefix.</p>
  
  <p>Is there a way for me to include a variable/parameter in all my routes that I can do something with before the request is dispatched, which won't be passed to the function?</p>