'Updated ContainerPackingList', 'message' => 'You have successfully updated the ContainerPackingList' ]; } /** @var CanUpdateContainerPackingList */ private $canUpdateContainerPackingList; /** @var UpdatesContainerPackingList */ private $updatesContainerPackingList; /** @var FetchesContainerPackingList */ private $fetchesContainerPackingList; /** * UpdateContainerPackingListLogic constructor. * @param CanUpdateContainerPackingList $canUpdateContainerPackingList * @param UpdatesContainerPackingList $updatesContainerPackingList * @param FetchesContainerPackingList $fetchesContainerPackingList */ public function __construct(CanUpdateContainerPackingList $canUpdateContainerPackingList, UpdatesContainerPackingList $updatesContainerPackingList, FetchesContainerPackingList $fetchesContainerPackingList) { $this->canUpdateContainerPackingList = $canUpdateContainerPackingList; $this->updatesContainerPackingList = $updatesContainerPackingList; $this->fetchesContainerPackingList = $fetchesContainerPackingList; } /** * @param Request $request * @return JsonResponse * @throws ErrorException */ public function logic(Request $request) : JsonResponse { $container = $this->fetchesContainerPackingList->execute(['id' => $request->route('id')]); $object = new ContainerPackingListObject( $container->packing_list_id , $request->input('container_reference'), $request->input('container_type'), $request->input('seal_reference')); $this->canUpdateContainerPackingList->passes($object); $query = $this->updatesContainerPackingList->execute($container, $object); return $this->resourceResponse(new ContainerPackingListResource($query)); } }