title: Laravel multiple parallel requests seems to cause wrong connection to be used
body: <p>I'm having a Laravel 5.2 single page app that after rendering in the DOM will fetch some settings via AJAX calls. It is very possible that many ajax calls are done simultaneously.</p>
  
  <p>Sometimes I will receive a 500 error because the table users cannot be found (which does exist). If I extract the query I can see that the used query language is sqlite while my database settings state that it should be sqlsrv. So it seems Laravel is using sqlite as database connection.</p>
  
  <p>Does anyone has any idea on why this happens and what I can do to prevent it?</p>
  
  <p>The database config is:</p>
  
  <pre><code>'connections' =&gt; [
  
      'sqlite' =&gt; [
          'driver' =&gt; 'sqlite',
          'database' =&gt; env('DB_DATABASE', database_path('database.sqlite')),
          'prefix' =&gt; '',
      ],
      'acti' =&gt; [
          'driver' =&gt; env('DB_ACTI_DRIVER', 'sqlite'),
          'host' =&gt; env('DB_ACTI_HOST', null),
          'database' =&gt; env('DB_ACTI_DATABASE', ':memory:'),
          'username' =&gt; env('DB_ACTI_USERNAME', null),
          'password' =&gt; env('DB_ACTI_PASSWORD', null),
          'charset' =&gt; env('DB_ACTI_CHARSET', 'utf8'),
          'prefix' =&gt; env('DB_ACTI_PREFIX', ''),
          'strict' =&gt; false,
          'engine' =&gt; null,
      ],
      'aspect' =&gt; [
          'driver' =&gt; env('DB_ASPECT_DRIVER', 'sqlite'),
          'host' =&gt; env('DB_ASPECT_HOST', null),
          'database' =&gt; env('DB_ASPECT_DATABASE', ':memory:'),
          'username' =&gt; env('DB_ASPECT_USERNAME', null),
          'password' =&gt; env('DB_ASPECT_PASSWORD', null),
          'charset' =&gt; env('DB_ASPECT_CHARSET', 'utf8'),
          'prefix' =&gt; env('DB_ASPECT_PREFIX', ''),
          'strict' =&gt; false,
          'engine' =&gt; null,
      ],
      'navision' =&gt; [
          'driver' =&gt; env('DB_NAVISION_DRIVER', 'sqlite'),
          'host' =&gt; env('DB_NAVISION_HOST', null),
          'database' =&gt; env('DB_NAVISION_DATABASE', ':memory:'),
          'username' =&gt; env('DB_NAVISION_USERNAME', null),
          'password' =&gt; env('DB_NAVISION_PASSWORD', null),
          'charset' =&gt; env('DB_NAVISION_CHARSET', 'utf8'),
          'prefix' =&gt; env('DB_NAVISION_PREFIX', ''),
          'strict' =&gt; false,
          'engine' =&gt; null,
      ]
  ]
  </code></pre>
  
  <p>The ajax code is as follows:</p>
  
  <pre><code>        $.ajax({
              type: 'GET',
              dataType: 'json',
              url: laroute.route('acti.preference.get', {
                  pluginName: this.plugin.name,
                  name: this.name
              }),
              success: $.proxy(function (data) {
                  this.updateFromApi(data.value);
                  if (data.value === undefined) {
                      this.saveToApi();
                  }
              }, this),
              error: function () {
                  console.log('receive error', arguments);
              }
          })
  </code></pre>
  
  <p>The standard connection is 'acti' and the .env holds the correct information.</p>
  
  <p>After some testing I can confirm that the env method does not always return the correct information. I can see that sometimes the default value (which is sqlite) is returned in stead of the actual data in the .env file.</p>