Error message:
Reply content:
Error message:
make
is the command to create a PHP file, you make:command
create a command line task, such as you create a command, you can execute the test
test task at the command line php artisan test
.
The tasks used for queue execution are typically "Job", by php artisan make:job
creating a job class and then dispatch(new FooJob)
performing this task in code. If this job is required to execute (asynchronously) in the queue (queues), the job class is implemented ShouldQueue
. When the job is added to a queue, the queue itself is to be started to ensure that the added job can be executed on a schedule and the queue is started with the php artisan queue:work
command line. The official documentation is very clear about all of these, and it's good grasp to look at it a few more times.
Https://laravel.com/docs/5.3/...
Chinese: Https://laravel-china.org/doc ...
When creating an event listener (listener) file, you can add parameters queued
to mark the listener to execute asynchronously in the queue, for example php artisan make:listener Foobar --queued
, to EventServiceProvider
define the correspondence between event events and listener. Using a function in code to event()
trigger an event, the framework invokes its code according to the listener defined in Eventserviceprovider, and if the listener is a queue, it is added to the queue.
Events, tasks, listening, and notifications in Laravel are related to the queue. But command (command line) has nothing to do with the queue, and command can be understood as php artisan
a command-line tool that follows. Command-line tools can be added to the system's scheduled tasks cron to be executed according to scheduled time, such as restarting the server 3 o'clock in the morning every day. Laravel provides a convenient way to implement cron scheduling tasks in the system, which app/Console/Kernel.php
can be schedule
written in the method.
There is no--queued option, what do you want to do?