I have a use case where we need to modify application flow if the application is being run from the command line via Artisan (migrations, seeds, route:list).
In Laravel
Not sure about any prior versions but in Laravel 5.2 you can still do App::runningInConsole() although it's not mentioned in the documentation.
App::runningInConsole()