Home > OS >  Laravel task schedule : run task schedule based on user need
Laravel task schedule : run task schedule based on user need

Time:04-05

a have a website that the user can generate a schedule reports daily/weekly/monthly according to their own schedule and priorities.

System should send some reports in any of the following scheduling capabilities as defined by the user:

Daily at a specific time defined by the user

Weekly on a specific day at a specific time defined by the user

Monthly on a specific date at a specific time defined by the user

so I need to run the task based on user input ex: if the user select daily report at 12 pm , he will receive a report on that time .

What are the best approaches to go forward with this?

CodePudding user response:

Laravel provides many options to set the cron jobs. https://laravel.com/docs/9.x/scheduling

In your case, you have multiple users, and based on the user input time you want to send the daily report by cron job.

So you can set the cronjob on an hourly basis. You just need to add proper time conditions within your code to fetch the proper data for a particular time like at 12pm and can send your reports using the Cron.

CodePudding user response:

In laravel they have default function called scheduling/cron Laravel - Scheduling

That will help you to set the time or weekly or monthly. you can also set the cron to send the data at 12pm thecron function can help you to send the document on particular time

  • Related