'Sales Agreement Document', 'message' => 'You have successfully uploaded sales agreement document' ]; } /** @var FetchesCompany */ private $fetchesCompany; /** @var CreatesDocument */ private $createsDocument; /** @var CreatesFiles */ private $createsFile; /** * CreatePaymentVerificationDocumentLogic constructor. * @param FetchesCompany $fetchesCompany * @param CreatesDocument $createsDocument * @param CreatesFiles $createsFile */ public function __construct(FetchesCompany $fetchesCompany, CreatesDocument $createsDocument, CreatesFiles $createsFile) { $this->fetchesCompany = $fetchesCompany; $this->createsDocument = $createsDocument; $this->createsFile = $createsFile; } /** * @param Request $request * @return JsonResponse * @throws \App\Classes\Exceptions\MalformedRequestException */ public function logic(Request $request) : JsonResponse { $company = $this->fetchesCompany->execute(['id' => $request->route('company_id')]); $object = new DocumentObject(DocumentType::SALES_AGREEMENT, $request->input('files'), '', ApprovalStatus::PENDING_VERIFICATION, 'sales_agreement'); /** @var Document $document */ $document = $this->createsDocument->execute($company, $object); $this->createsFile->execute($document, $object); return $this->response([]); } }