Problem
You want to check if your application is running in the console.
You know you can check php_sapi_name() but would like to use the more elegant, Laravel way.
Solution
Use App::runningInConsole()
if (App::runningInConsole())
{
echo "I'm in the console, baby!";
}
Discussion
Laravel actually uses php_sapi_name() to implement this method.
If php_sapi_name() equals 'cli' then your code is running in the console.
