The “--queued” option does not exist in Laravel 5.

2020-05-23 18:40发布

问题:

I'm going to create Queue job for mailing. once I hit the artisan command in command prompt php artisan make:job SendSMSMessages --queued I got the issue as is follow.

The "--queued" option does not exist.

I'm using Laravel 5.4

Please anyone can help me for the same. I have searched a lot but didn't found any good solutions.

Thanks

回答1:

The option --queued, was introduced in Laravel 5.0, and remained an option until version Laravel 5.1 https://laravel.com/docs/5.1/queues#writing-job-classes

Since Laravel version 5.2 onwards, --queued was deperecated as by default all newly created jobs are "queued". So your question was about version 5.4, you should create the job without the queued option as below:

artisan make:job SendSMSMessages

And here's the documentation reference for Jobs in Version 5.4 https://laravel.com/docs/5.4/queues#creating-jobs