title: Laravel 5 - One server / multiple databases determined by request
body: <p>So I am developing an application that has two kinds of deployments. One is they host everything and there is one application / one database and no issues. The second (the one this question will center around) will have one application but different database connections per client. </p>
  
  <p>Access to each domain will be white-listed so we don't have to worry about one client popping another clients domain in and their is other authentication on top of that. </p>
  
  <p>What I need is two-fold:</p>
  
  <ol>
  <li>a way to determine the client that is accessing the application (request headers? domain driven?)</li>
  <li>grab the configurations for said client so they only access their databases information (use a certain .env file based on client?).</li>
  </ol>
  
  <p>One idea I have thought of is using apache to set env variables based on the domain requested. However, I would prefer to keep this handling inside of laravel. Any ideas?</p>