From 905fdfcd31fa6cb09fe8dd98a4a3a9abe7e05ac9 Mon Sep 17 00:00:00 2001 From: arfenis Date: Fri, 2 Aug 2024 14:08:08 -0400 Subject: [PATCH] delete validation --- app/GraphQL/Inventory/Mutations/Warehouses/Warehouse.php | 7 +++++++ 1 file changed, 7 insertions(+) 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(); } }