fix: notif

This commit is contained in:
2025-12-13 16:13:19 +03:30
parent ba10906673
commit e0ade2d748
+4 -4
View File
@@ -25,7 +25,7 @@ class SendDueReminders extends Command
*/ */
public function handle(): int public function handle(): int
{ {
$now = now(); $now = now();
$currentTime = $now->toTimeString(); // HH:MM:SS $currentTime = $now->toTimeString(); // HH:MM:SS
$this->info("Current time: {$now}"); $this->info("Current time: {$now}");
@@ -33,8 +33,8 @@ public function handle(): int
$reminders = Reminder::with(['user', 'packageName']) $reminders = Reminder::with(['user', 'packageName'])
->where(function ($query) use ($now, $currentTime) { ->where(function ($query) use ($now, $currentTime) {
// Compare only the TIME portion // For PostgreSQL: Cast datetime to time for comparison
$query->whereRaw('TIME(time) <= ?', [$currentTime]) $query->whereRaw('time::time <= ?', [$currentTime])
->where(function ($sub) use ($now) { ->where(function ($sub) use ($now) {
// Non-repeatable: send once // Non-repeatable: send once
$sub->where('repeatable', false) $sub->where('repeatable', false)
@@ -54,7 +54,7 @@ public function handle(): int
foreach ($reminders as $reminder) { foreach ($reminders as $reminder) {
$this->info("Reminder ID {$reminder->id}: time={$reminder->time}, last_repeat={$reminder->last_repeat}"); $this->info("Reminder ID {$reminder->id}: time={$reminder->time}, last_repeat={$reminder->last_repeat}");
} }
if ($reminders->isEmpty()) { if ($reminders->isEmpty()) {
$this->info('No reminders due at this time.'); $this->info('No reminders due at this time.');
return Command::SUCCESS; return Command::SUCCESS;