Skip to content

A free open source IT asset/license management system

Remove the pivot company record for asking user if the “delete company” option is selected

snipe2e91b3dc9a04
diff --git a/app/Console/Commands/BulkDelete.php b/app/Console/Commands/BulkDelete.php
index 67d66a4e36..b8102236a5 100644
--- a/app/Console/Commands/BulkDelete.php
+++ b/app/Console/Commands/BulkDelete.php
@@ -329,6 +329,9 @@ class BulkDelete extends Command
} else {
$company->forceDelete();
}
+ // Remove any remaining pivot associations (e.g. the admin user who was
+ // skipped during user processing but is still a member of this company)
+ DB::table('company_user')->where('company_id', $company->id)->delete();
$this->reportLines[] = ucfirst($deleteCompanyType)."-deleted company {$company->name}";
}
}