I have a web route in my laravel project, and in that web route currently I’m calling an Artisan command I have defined in app/Console/Commands
. I’m doing Artisan::call(command)
.
So, it’s my understanding first of all that when I call it like that, my web request will wait for that to complete before it continues into the next bit of code, is that right? Does it wait for Artisan::call
to complete?
I would like a solution that doesn’t wait, and I have one potential workaround, but before I use my workaround, I want to make sure Artisan::callSilent()
doesn’t do what I want it to do. If I use callSilent
instead, will that run the artisan command in the backround without blocking the rest of the web request process?
2
Answers
Okay, so for the record
Artisan::call()
is blocking, andArtisan::callSilent()
... well, it doesn't even exist on my installed version of laravel, on the server I'm working on, so I have no idea.I'm using a workaround like this:
The CallsCommand.php shows the following functions:
So as the comments say,
callSilent
does the same thing as the call command, but doesn’t send any output. There’s also acallSilently()
, which just callscallSilent
, so it’s basically an alias.