'Update Document Reference', 'message' => 'You have successfully updated the Document Reference' ]; } /** @var CanUpdateDocumentReference*/ private $canUpdateDocumentReference; /** @var UpdatesDocumentReference */ private $updatesDocumentReference; /** @var FetchesDocument */ private $fetchesDocument; /** * RejectDocumentLogic constructor. * @param CanApproveDocument $canApproveDocument * @param ApprovesDocument $approvesDocument * @param FetchesDocument $fetchesDocument */ public function __construct(CanUpdateDocumentReference $canUpdateDocumentReference, UpdatesDocumentReference $updatesDocumentReference, FetchesDocument $fetchesDocument) { $this->canUpdateDocumentReference = $canUpdateDocumentReference; $this->updatesDocumentReference = $updatesDocumentReference; $this->fetchesDocument = $fetchesDocument; } /** * @param Request $request * @return JsonResponse * @throws \App\Classes\Exceptions\AccessForbiddenException * @throws \App\Classes\Exceptions\MalformedRequestException * @throws \App\Classes\Exceptions\RequestValidationException */ public function logic(Request $request) : JsonResponse { $document = $this->fetchesDocument->execute(['id' => $request->route('id')]); $this->canUpdateDocumentReference->passes(); $document_query = $this->updatesDocumentReference->execute($document, $request->input('identification_number')); return $this->resourceResponse(new DocumentResource($document_query)); } }