Why Laravel uses wrong database file after setting environment?
问题 In bootstrap/start.php I have the following: $env = $app->detectEnvironment(function() { if($myenv = getenv('APPLICATION_ENV')): return $myenv; else: return 'local'; endif; }); Ok so I setup a local folder and put in a database.php file with my local connections. Just to make sure its picking up the correct environment I put in the template: {{ App::environment(); }} which outputs local . But when making a DB call its giving me error: Undefined index : DB1_HOST My base (production) database