title: Laravel dynamic database connections
body: <p>I going to use dynamic database connections in backend.</p>
  
  <pre><code>        Config::set('database.connections._pgsql.host', $connection-&gt;host);
          Config::set('database.connections._pgsql.port', $connection-&gt;port);
          Config::set('database.connections._pgsql.username', $connection-&gt;account_name);
          Config::set('database.connections._pgsql.password', $connection-&gt;password);
          Config::set('database.connections._pgsql.database', $connection-&gt;initial_db);
  
          DB::purge('_pgsql');
          DB::reconnect('_pgsql');
  </code></pre>
  
  <p>As you see, I have to change db config every request to use dynamic db connections.
  If there are concurrent requests with different db connections then how can I handle these requests and connections?</p>
  
  <p>Please help me.</p>