'Updated PackingList Status', 'message' => 'You have successfully updated the PackingList status' ]; } /** @var FetchesPackingList */ private $fetchesPackingList; /** @var UpdatesPackingListStatus */ private $updatesPackingListStatus; /** @var UpdateDoFromVTPortalProcessor */ private $updateDoFromVTPortalProcessor; /** @var UpdateDoFromYDPortalProcessor */ private $updateDoFromYDPortalProcessor ; /** * UpdatePackingListStatusLogic constructor. * @param FetchesPackingList $fetchesPackingList * @param UpdatesPackingListStatus $updatesPackingListStatus * @param UpdateDoFromVTPortalProcessor $updateDoFromVTPortalProcessor * @param UpdateDoFromYDPortalProcessor $updateDoFromYDPortalProcessor */ public function __construct(FetchesPackingList $fetchesPackingList, UpdatesPackingListStatus $updatesPackingListStatus, UpdateDoFromVTPortalProcessor $updateDoFromVTPortalProcessor, UpdateDoFromYDPortalProcessor $updateDoFromYDPortalProcessor) { $this->fetchesPackingList = $fetchesPackingList; $this->updatesPackingListStatus = $updatesPackingListStatus; $this->updateDoFromVTPortalProcessor = $updateDoFromVTPortalProcessor; $this->updateDoFromYDPortalProcessor = $updateDoFromYDPortalProcessor; } /** * @param Request $request * @return JsonResponse * @throws \App\Classes\Exceptions\InternalServerErrorException * @throws \App\Classes\Exceptions\MalformedRequestException * @throws \GuzzleHttp\Exception\GuzzleException */ public function logic(Request $request) : JsonResponse { $packingList = $this->fetchesPackingList->execute(['id' => $request->route('id')]); /** @var PackingList $packingList */ $packingList = $this->updatesPackingListStatus->execute($packingList, $request->route('status')); // $appointee = $address->owner->orderRoles()->where('role_id', '=', OrderRoleTypes::ORIGIN_FREIGHT_FORWARDER)->first()->appointee->id; $this->updateDoFromVTPortalProcessor->execute($packingList); $this->updateDoFromYDPortalProcessor->execute($packingList); return $this->resourceResponse(new PackingListResource($packingList)); } }