mirror of
https://github.com/InvoiceShelf/InvoiceShelf.git
synced 2026-04-10 15:04:46 +00:00
Scope bulk delete to current company to prevent cross-company deletion
Filter customer IDs through whereCompany() before passing to deleteCustomers(), ensuring users cannot delete customers belonging to other companies via the bulk delete endpoint.
This commit is contained in:
@@ -92,7 +92,11 @@ class CustomersController extends Controller
|
||||
{
|
||||
$this->authorize('delete multiple customers');
|
||||
|
||||
Customer::deleteCustomers($request->ids);
|
||||
$ids = Customer::whereCompany()
|
||||
->whereIn('id', $request->ids)
|
||||
->pluck('id');
|
||||
|
||||
Customer::deleteCustomers($ids);
|
||||
|
||||
return response()->json([
|
||||
'success' => true,
|
||||
|
||||
Reference in New Issue
Block a user