Reputation: 8420
I have a route which calls the Artisan facade to execute:
Artisan::call('queue:work --once');
And I get :
But it's strange because in the command line, if i do:
php artisan queue:work --once
Works everything ok:
I can use other routes to call for example:
Artisan::call('config:clear');
And works ok too. Any idea?
Upvotes: 0
Views: 664
Reputation: 64
Laravel 5.8 introduced this new method of calling artisan commands:
Artisan::call('queue:work --once');
In previous releases use this:
Artisan::call('queue:work', ['--once' => true]);
Upvotes: 1
Reputation: 114
to call an artisan command from the code and passing some options you need to use an array as a 2nd argument to Artisan::call()
like so :
Artisan::call('queue:work', ['--once' => true]); // or whatever options you need
Upvotes: 0
Reputation: 269
the options value staring with -- are not passed to the string you can try :
Artisan::call('queue:work', ['--once' => true]);
Upvotes: 3