diff --git a/app/Http/Requests/UpdateTenantRequest.php b/app/Http/Requests/UpdateTenantRequest.php index 8c5ad504..6c3bff03 100644 --- a/app/Http/Requests/UpdateTenantRequest.php +++ b/app/Http/Requests/UpdateTenantRequest.php @@ -20,7 +20,7 @@ public function authorize(): bool */ public function rules(): array { - $tenantId = $this->route('tenant'); + $tenantId = $this->route('id'); return [ // 기본 정보 (필수) diff --git a/app/Services/TenantService.php b/app/Services/TenantService.php index beea804b..7c05368e 100644 --- a/app/Services/TenantService.php +++ b/app/Services/TenantService.php @@ -104,6 +104,13 @@ public function restoreTenant(int $id): bool public function forceDeleteTenant(int $id): bool { $tenant = Tenant::withTrashed()->findOrFail($id); + + // 관련 데이터 먼저 삭제 + $tenant->users()->detach(); // user_tenants 관계 삭제 + $tenant->departments()->forceDelete(); // 부서 영구 삭제 + $tenant->menus()->forceDelete(); // 메뉴 영구 삭제 + $tenant->roles()->forceDelete(); // 역할 영구 삭제 + return $tenant->forceDelete(); } diff --git a/resources/views/tenants/edit.blade.php b/resources/views/tenants/edit.blade.php index 6e5ae4b0..c1b6c169 100644 --- a/resources/views/tenants/edit.blade.php +++ b/resources/views/tenants/edit.blade.php @@ -15,9 +15,13 @@