$context */ public function __construct( public int $tenantId, public int $userId, public string $itemId, ?OperationRun $operationRun = null, public array $context = [], ) { $this->operationRun = $operationRun; } /** * @return array */ public function middleware(): array { return []; } public function handle(OperationRunService $runs): void { if (! $this->operationRun instanceof OperationRun) { throw new RuntimeException('OperationRun is required for bulk worker jobs.'); } $this->operationRun->refresh(); if ($this->operationRun->status === 'completed') { return; } try { $this->process($runs); } catch (Throwable $e) { $runs->failRun($this->operationRun, $e); throw $e; } } abstract protected function process(OperationRunService $runs): void; }