label('Archive') ->color('danger') ->requiresConfirmation() ->visible(fn (Tenant $record): bool => ! $record->trashed()) ->action(function (Tenant $record, WorkspaceAuditLogger $auditLogger): void { $user = auth()->user(); if (! $user instanceof User) { abort(403); } $record->delete(); $auditLogger->logTenantLifecycleAction( tenant: $record, action: AuditActionId::TenantArchived, actor: $user, context: [ 'metadata' => [ 'internal_tenant_id' => (int) $record->getKey(), 'tenant_guid' => (string) $record->tenant_id, ], ], ); Notification::make() ->title('Tenant archived') ->body('The tenant remains viewable in management and audit flows, but it is no longer selectable as active context.') ->success() ->send(); }) ) ->requireCapability(Capabilities::TENANT_DELETE) ->tooltip('You do not have permission to archive tenants.') ->preserveVisibility() ->destructive() ->apply(), ]; } }