'Deleted ContainerPackingList', 'message' => 'You have successfully deleted a ContainerPackingList' ]; } /** @var CanDeleteContainerPackingList */ private $canDeleteContainerPackingList; /** @var DeletesContainerPackingList */ private $deletesContainerPackingList; /** @var FetchesContainerPackingList */ private $fetchesContainerPackingList; /** * DeleteContainerPackingListControllersLogic constructor. * @param CanDeleteContainerPackingList $canDeleteContainerPackingList * @param DeletesContainerPackingList $deletesContainerPackingList * @param FetchesContainerPackingList $fetchesContainerPackingList */ public function __construct(CanDeleteContainerPackingList $canDeleteContainerPackingList, DeletesContainerPackingList $deletesContainerPackingList, FetchesContainerPackingList $fetchesContainerPackingList) { $this->canDeleteContainerPackingList = $canDeleteContainerPackingList; $this->deletesContainerPackingList = $deletesContainerPackingList; $this->fetchesContainerPackingList = $fetchesContainerPackingList; } /** * @param Request $request * @return JsonResponse * @throws ErrorException */ public function logic(Request $request) : JsonResponse { try { $this->canDeleteContainerPackingList->passes(); $query = $this->fetchesContainerPackingList->execute(['id' => $request->route('id')]); $this->deletesContainerPackingList->execute($query); return $this->response([]); } catch (\Exception $exception){ throw new ErrorException($exception->getMessage(), $exception->getCode()); } } }