|
@@ -18,21 +18,15 @@ class InvalidateExpiredSchedules implements ShouldQueue
|
|
|
$today = today();
|
|
$today = today();
|
|
|
$now = now();
|
|
$now = now();
|
|
|
|
|
|
|
|
- // Agendamentos aceitos cuja data já passou.
|
|
|
|
|
|
|
+ // Agendamentos aceitos ou pendente cujo a data já passou.
|
|
|
Schedule::query()
|
|
Schedule::query()
|
|
|
- ->where('status', 'accepted')
|
|
|
|
|
|
|
+ ->whereIn('status', ['accepted', 'pending'])
|
|
|
->whereDate('date', '<', $today)
|
|
->whereDate('date', '<', $today)
|
|
|
->update([
|
|
->update([
|
|
|
'status' => 'cancelled',
|
|
'status' => 'cancelled',
|
|
|
|
|
+ 'cancel_text' => 'Agendamento expirado',
|
|
|
]);
|
|
]);
|
|
|
|
|
|
|
|
- // Agendamentos pendentes cuja data já passou.
|
|
|
|
|
- Schedule::query()
|
|
|
|
|
- ->where('status', 'pending')
|
|
|
|
|
- ->whereDate('date', '<', $today)
|
|
|
|
|
- ->update([
|
|
|
|
|
- 'status' => 'cancelled',
|
|
|
|
|
- ]);
|
|
|
|
|
|
|
|
|
|
// Agendamentos pendentes de hoje cujo horário já terminou.
|
|
// Agendamentos pendentes de hoje cujo horário já terminou.
|
|
|
Schedule::query()
|
|
Schedule::query()
|
|
@@ -42,6 +36,7 @@ class InvalidateExpiredSchedules implements ShouldQueue
|
|
|
->whereRaw("CAST(end_time AS time) < ?", [$now->format('H:i:s')])
|
|
->whereRaw("CAST(end_time AS time) < ?", [$now->format('H:i:s')])
|
|
|
->update([
|
|
->update([
|
|
|
'status' => 'cancelled',
|
|
'status' => 'cancelled',
|
|
|
|
|
+ 'cancel_text' => 'Agendamento expirado',
|
|
|
]);
|
|
]);
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|