Initial Ladill Queue release — enterprise QMS standalone app.
Deploy Ladill Queue / deploy (push) Successful in 56s
Deploy Ladill Queue / deploy (push) Successful in 56s
Phases 1–6: tickets, counters, displays, appointments, workflows, rules, analytics, reports, feedback, admin, device API, and Gitea deploy workflow for queue.ladill.com. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -0,0 +1,43 @@
|
||||
<?php
|
||||
|
||||
namespace App\Console\Commands;
|
||||
|
||||
use App\Models\QueueAppointment;
|
||||
use App\Services\Qms\QueueNotificationService;
|
||||
use Illuminate\Console\Command;
|
||||
|
||||
class SendAppointmentRemindersCommand extends Command
|
||||
{
|
||||
protected $signature = 'qms:send-appointment-reminders {--minutes=60 : Remind appointments this many minutes ahead}';
|
||||
|
||||
protected $description = 'Send SMS/email reminders for upcoming appointments';
|
||||
|
||||
public function handle(QueueNotificationService $notifications): int
|
||||
{
|
||||
$minutes = (int) $this->option('minutes');
|
||||
$from = now();
|
||||
$to = now()->addMinutes($minutes);
|
||||
|
||||
$appointments = QueueAppointment::query()
|
||||
->where('status', 'scheduled')
|
||||
->whereBetween('scheduled_at', [$from, $to])
|
||||
->where(function ($q) {
|
||||
$q->whereNull('metadata')
|
||||
->orWhereNull('metadata->reminder_sent');
|
||||
})
|
||||
->get();
|
||||
|
||||
$count = 0;
|
||||
foreach ($appointments as $appointment) {
|
||||
$notifications->appointmentReminder($appointment);
|
||||
$metadata = $appointment->metadata ?? [];
|
||||
$metadata['reminder_sent'] = now()->toIso8601String();
|
||||
$appointment->update(['metadata' => $metadata]);
|
||||
$count++;
|
||||
}
|
||||
|
||||
$this->info("Sent {$count} appointment reminder(s).");
|
||||
|
||||
return self::SUCCESS;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user