Search code examples
laravellaravel-artisan

Laravel, call Artisan from php differs from command line


I have a route which calls the Artisan facade to execute:

Artisan::call('queue:work --once');

And I get :

enter image description here

But it's strange because in the command line, if i do:

php artisan queue:work --once

Works everything ok:

enter image description here

I can use other routes to call for example:

Artisan::call('config:clear');

And works ok too. Any idea?


Solution

  • the options value staring with -- are not passed to the string you can try :

    Artisan::call('queue:work', ['--once' => true]);