5

I found this similar question How to check If the current app process is running within a queue environment in Laravel

But actually this is the opposite of what I want. I want to be able to distinguish between code being executed manually from an artisan command launched on the CLI, and when a job is being run as a result of a POST trigger via a controller, or a scheduled run

Basically I want to distinguish between when a job is being run via the SYNC driver, manually triggered by the developer with eyes on the CLI output, and otherwise

app()->runningInConsole() returns true in both cases so it is not useful to me

Is there another way to detect this? For example is there a way to detect the currently used queue connection? Keeping in mind that it's possible to change the queue connection at runtime so just checking the value of the env file is not enough

vesperknight
  • 720
  • 9
  • 17

0 Answers0