can i use laravel Queues to delete some table records automaticaly?

2712 views php
6

I need delete some records from my one table which old than 15 days form now. I am working with laravel 5.6 and hope to use Queues for this job. and do not hope to use Task Scheduler for this task. my job is like this.

$vehicles = Vehicle::where('created_at', '<', Carbon::now()->subDays(15))->delete();

My problem is I need run above task every day. so may I use Queues to fulfill this task for every day?

answered question

1 Answer

3

The short answer is no. You place jobs into queues. A job could be created to do this task but what is going to place the job into a queue? This would typically either happen during some kind of fired event or if it needs to be done on a schedule (like daily) it would be done by the task scheduler.

If you must accomplish this with a queue and without the task scheduler, you could write a custom console command and kick it off with a cron entry.

posted this

Have an answer?

JD

Please login first before posting an answer.