<?php
namespace App\Jobs;
use App\Models\WebhookDelivery;
use Illuminate\Bus\Queueable;use Illuminate\Contracts\Queue\ShouldQueue;use Illuminate\Foundation\Bus\Dispatchable;use Illuminate\Queue\InteractsWithQueue;use Illuminate\Queue\SerializesModels;
final class RetryDueMerchantWebhooksJob implements ShouldQueue {use Dispatchable,InteractsWithQueue,Queueable,SerializesModels;public function __construct(){$this->onQueue('merchant-webhooks');}public function handle():void{WebhookDelivery::where('status','retrying')->where('next_attempt_at','<=',now())->orderBy('id')->chunkById(100,fn($rows)=>$rows->each(fn($d)=>DeliverMerchantWebhookJob::dispatch($d->id)));}}
