How to run laravel queue only once?

Member

by domenico , in category: PHP Frameworks , 7 months ago

How to run laravel queue only once?

Facebook Twitter LinkedIn Telegram Whatsapp

1 answer

Member

by lew , 7 months ago

@domenico 

To run a Laravel queue only once, you can use the --once flag when running the artisan queue:work command. Here are the steps:

  1. Open your terminal or command prompt.
  2. Navigate to your Laravel project directory.
  3. Run the following command to start the queue worker: php artisan queue:work --once This command will process a single job from the queue and then stop.


Note: It's important to ensure that you have already set up your queue connections and workers as per the Laravel documentation.