zot24
6/27/2014 - 8:31 AM

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 whi

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');
});