title: Changing the app url inside a Laravel 4.2 Artisan command
body: <p>I run a multi-tenant site built in Laravel 4.2. In the App config, I'm aware that you can set a single base URL, e.g.</p>
  
  <pre><code>/*
  |--------------------------------------------------------------------------
  | Application URL
  |--------------------------------------------------------------------------
  |
  | This URL is used by the console to properly generate URLs when using
  | the Artisan command line tool. You should set this to the root of
  | your application so that it is used when running Artisan tasks.
  |
  */
  
  'url' =&gt; 'http://apples.local',
  </code></pre>
  
  <p>I've built an Artisan command to deliver scheduled emails to users, no matter which domain they access the site through. So the command needs to generate urls with a different domain, e.g. <code>http://oranges.local</code>.</p>
  
  <p>In my command, I'm attempting to alter the <code>app.url</code> config variable before generating a URL, but it seems to have no affect:</p>
  
  <pre><code>Config::set('app.url', 'http://oranges.local');
  $this-&gt;info('App URL: ' . Config::get('app.url'));
  $this-&gt;info('Generated:' . URL::route('someRoute', ['foo', 'bar']));
  </code></pre>
  
  <p>Despite physically altering the config at runtime, this still always produces:</p>
  
  <pre><code>App URL: http://oranges.local
  Generated: http://apples.local/foo/bar
  </code></pre>
  
  <p>The URL generator is completely ignoring the app config!</p>
  
  <p>I know I can setup multiple environments and pass <code>--env=oranges</code> to Artisan, but in my use case this isn't really practical. I just want the ability to set the app url site-wide during runtime.</p>
  
  <p>Any ideas?</p>