title: Database [] not configured - Laravel
body: <p>I have searched a lot about it and tried every possible solution I could find or think of.</p>
  
  <p>So I am changing database configuration to a new database as follows:</p>
  
  <pre><code>DB::disconnect('mysql');
  config(['database.connections.mysql.database' =&gt; $new_db_name]);
  </code></pre>
  
  <p>If i try to get the database name like:</p>
  
  <pre><code>dd(config('database.connections.mysql.database'));
  </code></pre>
  
  <p>I get the right database name which I just set. But when i try to run migration on it:</p>
  
  <pre><code>\Artisan::call('migrate', ['--database' =&gt; $new_db_name ]);
  </code></pre>
  
  <p>I get the error : <strong>Database [$new_db_name] not configured</strong></p>
  
  <p>Any help is appreciated.</p>