'Retrieved ContainerPackingList', 'message' => 'You have successfully retrieved a ContainerPackingList' ]; } /** @var CanFetchContainerPackingList */ private $canFetchContainerPackingList; /** @var FetchesContainerPackingList */ private $fetchesContainerPackingList; /** * FetchContainerPackingListControllersLogic constructor. * @param CanFetchContainerPackingList $canFetchContainerPackingList * @param FetchesContainerPackingList $fetchesContainerPackingList */ public function __construct(CanFetchContainerPackingList $canFetchContainerPackingList, FetchesContainerPackingList $fetchesContainerPackingList) { $this->canFetchContainerPackingList = $canFetchContainerPackingList; $this->fetchesContainerPackingList = $fetchesContainerPackingList; } /** * @param Request $request * @return JsonResponse * @throws ErrorException */ public function logic(Request $request) : JsonResponse { try { $this->canFetchContainerPackingList->passes(); $query = $this->fetchesContainerPackingList->execute(['id' => $request->route('id')]); return $this->resourceResponse(new ContainerPackingListResource($query)); } catch (\Exception $exception){ throw new ErrorException($exception->getMessage(), $exception->getCode()); } } }