$input['name'], 'datacenter' => $input['datacenter'], 'public_ip' => $input['public_ip'], 'status' => 'pending', ]); $run = ProvisioningRun::create([ 'subject_type' => Host::class, 'subject_id' => $host->id, 'pipeline' => 'host', 'status' => ProvisioningRun::STATUS_PENDING, 'current_step' => 0, 'context' => ['root_password' => Crypt::encryptString($input['root_password'])], ]); return [$host, $run]; }); AdvanceRunJob::dispatch($run->uuid); // after commit — the run definitely exists return $host; } }