update lisensi prosess
tests / ci (push) Has been cancelled

This commit is contained in:
Wian Drs
2026-08-25 13:43:55 +07:00
parent 1e80be180e
commit 60946ddf37
58 changed files with 2903 additions and 165 deletions
+10 -2
View File
@@ -29,7 +29,7 @@ class TenantProvisioningService
TenantDevicePolicy::create(['tenant_id' => $tenant->id]);
app(TenantEnvelopeEncryption::class)->ensureKey($tenant->id);
$deploymentType = $data['deployment_type'] ?? 'managed_cloud';
DeploymentInstallation::create([
$installation = DeploymentInstallation::create([
'tenant_id' => $tenant->id,
'name' => $deploymentType === 'self_hosted' ? 'Server Tenant' : 'RADIQ Managed Cloud',
'deployment_type' => $deploymentType,
@@ -38,6 +38,14 @@ class TenantProvisioningService
'status' => $deploymentType === 'managed_cloud' ? 'active' : 'pending',
'activated_at' => $deploymentType === 'managed_cloud' ? now() : null,
]);
$defaultPlan = $deploymentType === 'managed_cloud' ? 'cloud_free' : 'local_micro';
app(LicenseEntitlementService::class)->provisionInitial(
$tenant,
$installation,
$data['plan_code'] ?? $defaultPlan,
(bool) ($data['activate_license'] ?? true),
$data['issued_by'] ?? null,
);
$this->context->set($tenant->id);
setPermissionsTeamId($tenant->id);
@@ -52,7 +60,7 @@ class TenantProvisioningService
'password' => $data['owner_password'],
'is_active' => true,
]);
$owner->forceFill(['email_verified_at' => now()])->save();
$owner->forceFill(['email_verified_at' => ($data['email_verified'] ?? true) ? now() : null])->save();
$owner->assignRole($roles[SystemRole::TenantAdmin->value]);
} finally {
$this->context->clear();