$app->runningInConsole() code example Example: laravel app running in console app()->runningInConsole()