/** * Handles the command. * * @param CloseRequestCommand $command */ public function handle($command) { $onlineForm = $this->onlineFormRepository->getFormByFormableID($command->id); $onlineForm->stage = 0; $onlineForm->status = 1; $updateOnlineForm = $this->onlineFormRepository->save($onlineForm); if ($onlineForm->form_type == 'RequestForPayment' && $updateOnlineForm) { $closeForm = $this->rfpRepository->closeForm($onlineForm->formable_id); } return $this->onlineFormRepository->closeRequest($command->id); }
/** * Handles the command. * * @param EditRFPCommand $command * @return RequestForPayment */ public function handle($command) { $rfp = $this->rfpRepository->getFormByFormNum($command->form_num); if ($rfp) { $rfp->payee_firstname = $command->payee_firstname; $rfp->payee_middlename = $command->payee_middlename; $rfp->payee_lastname = $command->payee_lastname; $rfp->date_requested = $command->date_requested; $rfp->particulars = $command->particulars; $rfp->total_amount = $command->total_amount; $rfp->client_id = $command->client_id; $rfp->check_num = $command->check_num; $rfp->date_needed = $command->date_needed; $this->rfpRepository->save($rfp); $onlineForm = $this->onlineFormRepository->getFormByFormableID($rfp->id); $onlineForm->department_id = $command->department_id; $this->onlineFormRepository->save($onlineForm); } return $rfp; }