0
votes

I'm trying to use Laravel Queues for sending emails using the database driver, I have already configured it, run the migration for the "jobs" table and when I run this:

Mail::to($user->email)->queue(new CompraRealizadaAdmin(Cart::content(), $monto_descuento, $envio, $user_array, $direccion, $compra));

A record is added on the "jobs" table, but, how do I run the queue on the database table?, I understand that for triggering it at the moment it is added, I will need to run the command php artisan queue:listen, or if I need to run all the ones that are still on queue, I will use php artisan queue:work.

But how do I run the command without the need to open terminal and keep it open until it has finished...?

I had the idea of creating a schedule and run it every minute and just execute the code: Artisan::call('queue:work'); but that does not work.

Any ideas?

2

2 Answers

0
votes

Depending on your needs, preferences and your target OS you can use

or alike services to manage your queue worker processes.

In fact Laravel documentation explains in great detail how to install and configure supervisord for this.

0
votes

It depends on which OS you are working on for Ubuntu or linux you can use supervisor and hup.

butt be careful you have to run hup every time you reboot your machine.

thats how you can run this command. hup php artisan queue:work.

Hope this helps