Suppose I have a database like this.
| task | time |
|---------------------------|---------------------------|
| Remind me to water plants | 2018-02-18T19:32:10.486Z |
| English Test | 2018-10-8T09:30:00.000Z |
| Math Test | 2018-10-8T10:30:00.000Z |
And I want to send a reminder notification to the user at the time it has been requested (or maybe an hour before) by the user and also execute some other block of code at that specific time when reminder notification is triggered.
I am thinking of writing a cron job something like this
* * * * * php /laravel-project/artisan schedule:run >> /dev/null 2>&1
as mentioned in laravel documentation (https://laravel.com/docs/5.6/scheduling).
And inside that script, I will be looping onto current time reminders and reminders within next hour and perform actions.
Is it a good practice? Won't it increase traffic between PHP and database? What if i have lot of reminders within the same hour, looping into that and executing blocks of code foreach reminder will be it a good idea?
Please suggest ideas