limit(150) ->get(); $count = 0; foreach ($jobs as $index => $delayedJob) { $jobClass = $delayedJob->job_class; if($jobClass === UpdatePerfexCRMPrelude::class){ $params = json_decode($delayedJob->parameters, true); Log::info('ProcessDelayedJobsV2Command packingList : ' . json_encode($params['packingList'])); Log::info('ProcessDelayedJobsV2Command packingList id : ' . json_encode($params['packingList']['id'])); Log::info('ProcessDelayedJobsV2Command transaction : ' . json_encode($params['transaction'])); Log::info('ProcessDelayedJobsV2Command updatePerfexCRMObject : ' . json_encode($params['updatePerfexCRMObject'])); Log::info('ProcessDelayedJobsV2Command shouldCreateInvoice : ' . json_encode($params['shouldCreateInvoice'])); $updatePerfexCRMObject = UpdatePerfexCRMObject::fromJson(json_encode($params['updatePerfexCRMObject'])); $packingList = PackingList::where('id', $params['packingList']['id'])->first(); $singleDelayedJob = new $jobClass( $packingList, $params['transaction'], $updatePerfexCRMObject, $params['shouldCreateInvoice'] ); $delayInSeconds = intdiv($index, 2) * 10 ; dispatch($singleDelayedJob)->delay(now()->addSeconds($delayInSeconds)); $delayedJob->delete(); $count++; } } Log::info('ProcessDelayedJobsV2Command Total delayed jobs processed and dispatched: ' . $count); } }