Files
ladill-pos/app/Console/Commands/CancelStalePayments.php
T
isaaccladandCursor e5d2b84388
Deploy Ladill Mini / deploy (push) Successful in 23s
Add Ladill POS v1 — register, Pay checkout, and commerce links.
Staff-facing counter register at pos.ladill.com with catalog cart, cash and
MoMo/card checkout via Ladill Pay, CRM timeline/import, invoice prefill, and
Merchant catalog import.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-06-23 22:52:24 +00:00

35 lines
936 B
PHP

<?php
namespace App\Console\Commands;
use App\Models\MiniPayment;
use Illuminate\Console\Command;
/**
* Cancels Mini payments left pending longer than MiniPayment::STALE_PENDING_HOURS.
* Scheduled hourly (routes/console.php).
*/
class CancelStalePayments extends Command
{
protected $signature = 'mini:cancel-stale-payments';
protected $description = 'Cancel Ladill Mini payments stuck pending beyond the stale window.';
public function handle(): int
{
$cutoff = now()->subHours(MiniPayment::STALE_PENDING_HOURS);
$count = MiniPayment::query()
->where('status', MiniPayment::STATUS_PENDING)
->where('created_at', '<', $cutoff)
->update([
'status' => MiniPayment::STATUS_CANCELED,
'updated_at' => now(),
]);
$this->info("Canceled {$count} stale pending payment(s).");
return self::SUCCESS;
}
}