diff --git a/app/Utilities/helpers.php b/app/Utilities/helpers.php index 8061d1cfb..01be4ae3c 100644 --- a/app/Utilities/helpers.php +++ b/app/Utilities/helpers.php @@ -179,6 +179,19 @@ if (! function_exists('running_in_queue')) { } } +if (! function_exists('running_in_schedule')) { + /** + * Detect if application is running in schedule. + */ + function running_in_schedule(): bool + { + return app()->runningConsoleCommand([ + 'schedule:run', + 'schedule:work', + ]); + } +} + if (! function_exists('running_in_test')) { /** * Detect if application is running in test.