Refatorando funções inline e download para fazer o print

laravel-11
jtfnetoo 3 years ago
parent bf76c500c0
commit 81813b5ad3

@ -85,13 +85,13 @@ interface JasperServerRequestServiceContract
public function call(string $uri): JasperServerRequestService; public function call(string $uri): JasperServerRequestService;
/** /**
* @return string * @return void
*/ */
public function inline(): string; public function inline(): void;
/** /**
* @param string|null $filename * @param string|null $filename
* @return string * @return void
*/ */
public function download(?string $filename): string; public function download(?string $filename): void;
} }

@ -230,26 +230,27 @@ class JasperServerRequestService implements JasperServerRequestServiceContract
} }
/** /**
* @return string * @return void
*/ */
public function inline(): string public function inline(): void
{ {
$this->setContentDisposition(ContentDispositionEnum::INLINE); $this->setContentDisposition(ContentDispositionEnum::INLINE);
return $this->getReport(); $this->setHeader($this->report);
echo $this->getReport();
} }
/** /**
* @param string|null $filename * @param string|null $filename
* @return string * @return void
*/ */
public function download(?string $filename): string public function download(?string $filename): void
{ {
if (in_array($this->format, ReportFormatEnum::downloadable())) { if (in_array($this->format, ReportFormatEnum::downloadable())) {
$this->setContentDisposition(ContentDispositionEnum::ATTACHMENT); $this->setContentDisposition(ContentDispositionEnum::ATTACHMENT);
$this->setHeader($this->report, $filename); $this->setHeader($this->report, $filename);
} }
return $this->getReport(); echo $this->getReport();
} }
/** /**

Loading…
Cancel
Save