diff --git a/app/Services/Sales/TenantProspectService.php b/app/Services/Sales/TenantProspectService.php index c16d8e9e..a8d0aa2a 100644 --- a/app/Services/Sales/TenantProspectService.php +++ b/app/Services/Sales/TenantProspectService.php @@ -103,9 +103,13 @@ public function update( public function convertToTenant(TenantProspect $prospect, int $convertedBy): Tenant { return DB::transaction(function () use ($prospect, $convertedBy) { + // 고유 테넌트 코드 생성 (T + 타임스탬프 + 랜덤) + $tenantCode = 'T' . now()->format('ymd') . strtoupper(substr(uniqid(), -4)); + // 테넌트 생성 $tenant = Tenant::create([ 'company_name' => $prospect->company_name, + 'code' => $tenantCode, 'business_num' => $prospect->business_number, 'ceo_name' => $prospect->ceo_name, 'phone' => $prospect->contact_phone,