diff --git a/app/Classes/Modules/PackingLists/ControllersLogic/DeletePackingListLogic.php b/app/Classes/Modules/PackingLists/ControllersLogic/DeletePackingListLogic.php index 09f6453f..19ded60f 100644 --- a/app/Classes/Modules/PackingLists/ControllersLogic/DeletePackingListLogic.php +++ b/app/Classes/Modules/PackingLists/ControllersLogic/DeletePackingListLogic.php @@ -8,6 +8,7 @@ use App\Classes\Modules\PackingLists\Services\DeletesPackingList; use App\Classes\Modules\PackingLists\Services\FetchesPackingList; use App\Classes\Modules\PackingLists\Standards\Rules\CanDeletePackingList; use App\Classes\ValueObjects\Constants\PackingListType; +use App\Models\PackingList; use ErrorException; use Illuminate\Http\JsonResponse; use Illuminate\Http\Request; @@ -59,11 +60,9 @@ class DeletePackingListLogic extends AbstractControllerLogic $this->canDeletePackingList->passes(); - $warehouseList = $this->fetchesPackingList->execute(['id' => $request->route('id')]); - $packingList = $this->fetchesPackingList->execute(['reference' => $warehouseList->reference, 'type' => PackingListType::SHIPPING_PACKING_LIST]); + $packingList = $this->fetchesPackingList->execute(['id' => $request->route('id')]); - $this->deletesPackingList->execute($warehouseList); - $this->deletesPackingList->execute($packingList); + PackingList::where('reference', $packingList->reference)->delete(); return $this->response([]);