Пример #1
0
 /**
  * @param CoverageEditFormRequest $request
  * @param string                  $rp_id
  * @param string                  $de_id
  * @param string                  $header_id
  *
  * @return mixed
  */
 public function coverageUpdate(CoverageEditFormRequest $request, $rp_id, $de_id, $header_id)
 {
     if (Cache::has(decode($header_id)) && $this->retailerProductRepository->getRetailerProductById(decode($rp_id))) {
         $retailerProduct = $this->retailerProductRepository->getModel();
         if ($this->repository->getHeaderById(decode($header_id)) && $this->headerDeRepository->getHeaderById(decode($de_id))) {
             $header = $this->repository->getModel();
             $de = $this->headerDeRepository->getModel();
             if ($this->repository->setVehicleResult($retailerProduct, $header) && $this->repository->updateCoverage($request, $de)) {
                 $rp_de = Cache::get(decode($header_id));
                 return redirect()->route('de.issuance', ['rp_id' => $rp_de, 'header_id' => $de_id])->with(['success_header' => 'La garantía fue asociada correctamente.']);
             }
         }
     }
     return redirect()->back()->with(['error_header' => 'La cobertura no puede ser emitida . ']);
 }