title: How to set different Laravel 5 storage and cache path local vs production?
body: <p>I can't find any good answers on how to best set different storage and cache paths for my Laravel 5 application based on which environment it's running on.</p>
  
  <p>I specially want to change the storage path and the cache path.</p>
  
  <p>At the moment the config/cache.php has a line like this:</p>
  
  <pre><code>'path'   =&gt; storage_path().'/framework/cache',
  </code></pre>
  
  <p>I want to change that to "/www/app-cache/" for production environment only.</p>
  
  <p>And I want to change the default storage_path to "/www/app-store/" for production environment only.</p>
  
  <p>Is there a good way to achieve this?</p>
  
  <p>At the moment I have created a new application class which extends the old one, like this:</p>
  
  <pre><code>&lt;?php namespace App;
  
  use Illuminate\Foundation\Application;
  
  class XXXApplication extends Application
  {
      public function storagePath()
      {
          if($this-&gt;environment('production')) {
              return '/www/app-store/';
          }
  
          return parent::storagePath();
      }
  }
  </code></pre>
  
  <p>Is that a smart way to do it, and if so, how do I also change the cache path?</p>