diff --git a/app/GraphQL/Inventory/Mutations/Warehouses/Warehouse.php b/app/GraphQL/Inventory/Mutations/Warehouses/Warehouse.php index 47a66cd72..f57877f83 100644 --- a/app/GraphQL/Inventory/Mutations/Warehouses/Warehouse.php +++ b/app/GraphQL/Inventory/Mutations/Warehouses/Warehouse.php @@ -4,7 +4,9 @@ namespace App\GraphQL\Inventory\Mutations\Warehouses; +use Kanvas\Companies\Repositories\CompaniesRepository; use Kanvas\Inventory\Regions\Repositories\RegionRepository; +use Kanvas\Inventory\Variants\Actions\DeleteWarehouseAction; use Kanvas\Inventory\Warehouses\Actions\CreateWarehouseAction; use Kanvas\Inventory\Warehouses\DataTransferObject\Warehouses as WarehousesDto; use Kanvas\Inventory\Warehouses\Models\Warehouses; @@ -56,6 +58,11 @@ public function delete(mixed $root, array $request): bool { $warehouse = WarehouseRepository::getById((int) $request['id'], auth()->user()->getCurrentCompany()); + CompaniesRepository::userAssociatedToCompany( + $warehouse->company, + auth()->user() + ); + return $warehouse->delete(); } }