title: Access denied 'homestead'@'localhost' when running a Laravel Command
body: <p>I'm having some trouble getting Laravel to connect to my database, when using a custom Artisan command.</p>
  
  <p>I can post my command but I'll skip to my db settings as I suspect that is what is wrong. In <code>start.php</code> I have:</p>
  
  <pre><code>$env = $app-&gt;detectEnvironment(array(
  
      'local' =&gt; array('homestead'),
  
  ));
  </code></pre>
  
  <p>and then I have no local/database.php files in my config. Instead I have a <code>.env.local.php</code> which works great for everything except this. All database settings are set as <code>'DB_NAME =&gt; getenv('DB_NAME');</code> etc.</p>
  
  <p>When I run <code>php artisan custom:command</code> I get the following:</p>
  
  <pre><code>[Illuminate\Database\QueryException]                                                                                    
    SQLSTATE[3D000]: Invalid catalog name: 1046 No database selected (SQL: select * from `users` where `paused_until` = 3)  
  </code></pre>
  
  <p>Then if I run </p>
  
  <pre><code>php artisan fdb:reactivate-paused --env=local
  </code></pre>
  
  <p>I seem to get much closer but still get:</p>
  
  <pre><code>Access denied for user 'homestead'@'localhost' (using password: YES)   
  </code></pre>
  
  <p>Is it that Laravel doesn't know to use the .env.local.php file when I am running commands in the terminal? All my migrate and db:seed queries seem to work fine. Can anyone point me in the right direction?</p>