services() ->where('type', ServiceType::LARAVEL) ->get() ->first(fn (Service $service): bool => in_array('web', $service->process_roles ?? [], true)); if (! $service || $service->type !== ServiceType::LARAVEL) { throw new InvalidArgumentException('Laravel migrations must run against a Laravel runtime service.'); } $operation = $service->operations()->create([ 'kind' => OperationKind::CONFIG_CHANGE, 'status' => OperationStatus::PENDING, ]); $operation->steps()->create([ 'name' => 'Run Laravel migrations', 'order' => 1, 'status' => OperationStatus::PENDING, 'script' => $this->buildMigrationScript->execute($service, respectAutomaticMode: false), ]); return $operation; } }