Hello everyone. I posted this over at the Laravel.io forums and got little response.. seeing if I have better luck here.
I've been struggling with this particular issue for a few hours. I created a basic server on DigitalOcean through Laravel Forge. I created a site on the server that has an instance of Laravel 4.2. To detect my environment, I'm using a closure (taken from this article). Here is my exact code:
// start.php
$env = $app->detectEnvironment(function() {
if (getenv('APP_NAME_ENV')) {
return getenv('APP_NAME_ENV');
} else {
return 'local';
}
});
Using Forge, I updated my environment variables on my site and set "APP_NAME_ENV" to be "staging". I did not fill in anything for the "environment" field.
Next, I SSH'd into my server and navigated to my site's root directory. First, I tried just executing "php artisan env", which returned "local". Next, I used artisan tinker to execute "App::environment();", which again turned up "local".
I restarted both nginx and the entire server, tried the above steps again and it still comes back with "local". Based on the environment variable that I set, I expect to see "staging".
I don't think I've done anything out of the ordinary here.. I've read up on this issue and others seem to have success doing the same exact thing I'm doing. Can anyone offer any insight or have clues about where I can investigate next? I'd really prefer to use the closure technique rather than explicitly identify my hostnames for environment detection.
Thanks!