<?php
namespace App\Console\Commands;use App\Jobs\SendTransferNotification;use App\Models\Transfer;use Illuminate\Console\Command;
class NotifyCodesExpiringSoon extends Command {protected $signature='transfers:notify-expiring';protected $description='Notify send merchants about transfers expiring in 24 hours';public function handle():int{Transfer::where('status','issued')->whereBetween('expires_at',[now()->addHours(23),now()->addHours(25)])->chunkById(100,fn($rows)=>$rows->each(fn($t)=>SendTransferNotification::dispatch($t->id,'expiring')));return self::SUCCESS;}}
