Skip to content

Instantly share code, notes, and snippets.

@zot24
Created June 27, 2014 08:31
Show Gist options
  • Save zot24/518e6a6627f46f04e4b5 to your computer and use it in GitHub Desktop.
Save zot24/518e6a6627f46f04e4b5 to your computer and use it in GitHub Desktop.
This is how I detect my environment with Laravel, if I'm running from the console outside of Vagrant I'm calling the environment console which have all the credentials to access the database from outside of the virtual machine. And if I'm using the browser and there is not ENV set up I'm using by default development environment.
$env = $app->detectEnvironment(function () use ($app)
{
return getenv('ENV') ?: ($app->runningInConsole() ? 'console' : 'development');
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment