title: Laravel - How to clear config:cache on each request
body: <p>I am working on a project which will have 50 subdomains and I found a solution to load separate <code>.env</code> file based on a domain name and everything is working fine... now my problem is</p>
  <blockquote>
  <p>I have to run command <code>config:cache</code> to clear the cache so sytem can load relevant <code>.env</code> file, otherwise, it keeps loading the older <code>.env</code> file. How can i ask system to do cache clear on each load in <code>bootstrap/app.php</code> file???</p>
  </blockquote>
  <p>My Code to load <code>.env</code> files in <code>bootstrap/app.php</code></p>
  <pre><code>$domain = '';
  if(isset($_SERVER['HTTP_HOST']) &amp;&amp; !empty($_SERVER['HTTP_HOST'])){
      $domain = $_SERVER['HTTP_HOST'];
  }
  
      if ($domain) {
          $dotenv = \Dotenv\Dotenv::create(base_path(), '.env.'.$domain.'.env');
      
          try {
              $dotenv-&gt;overload();
      
          } catch (\Dotenv\Exception\InvalidPathException $e) {
              // No custom .env file found for this domain
          }
      }
  </code></pre>