1

Users in the application save a reminder for example at 10:45 and the system should send an email or message to him every 30 minutes. the problem is time starts from 11 and sends the message to the user at 11, 11:30, 12, 12:30, ... It doesn't start from 10:45. It should start from the time that user creates its reminder.

in following example $reminder->expression is for example */30 * * * *

Kernel.php

$user->reminders()->active()->each(function ($reminder) use ($user, $schedule) {
    return $schedule->call(function () use ($reminder) {
         $sendReminder = app(SendReminder::class , ['reminder' => $reminder]);
         $sendReminder->sendReminder(); 
     })->cron($reminder->expression);
});
ali Falahati
  • 599
  • 7
  • 18

0 Answers0