From e0ade2d748fed4815f755b473b62fd4754550685 Mon Sep 17 00:00:00 2001 From: AmirmahdiNourkazemi Date: Sat, 13 Dec 2025 16:13:19 +0330 Subject: [PATCH] fix: notif --- app/Console/Commands/SendDueReminders.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/app/Console/Commands/SendDueReminders.php b/app/Console/Commands/SendDueReminders.php index eb011ca..b77c2f7 100644 --- a/app/Console/Commands/SendDueReminders.php +++ b/app/Console/Commands/SendDueReminders.php @@ -25,7 +25,7 @@ class SendDueReminders extends Command */ public function handle(): int { - $now = now(); + $now = now(); $currentTime = $now->toTimeString(); // HH:MM:SS $this->info("Current time: {$now}"); @@ -33,8 +33,8 @@ public function handle(): int $reminders = Reminder::with(['user', 'packageName']) ->where(function ($query) use ($now, $currentTime) { - // Compare only the TIME portion - $query->whereRaw('TIME(time) <= ?', [$currentTime]) + // For PostgreSQL: Cast datetime to time for comparison + $query->whereRaw('time::time <= ?', [$currentTime]) ->where(function ($sub) use ($now) { // Non-repeatable: send once $sub->where('repeatable', false) @@ -54,7 +54,7 @@ public function handle(): int foreach ($reminders as $reminder) { $this->info("Reminder ID {$reminder->id}: time={$reminder->time}, last_repeat={$reminder->last_repeat}"); } - + if ($reminders->isEmpty()) { $this->info('No reminders due at this time.'); return Command::SUCCESS;