Merge pull request #2013 from burakcakirel/document-pdf
Change storeInvoicePdfAndGetPath method to storeDocumentPdfAndGetPath…
This commit is contained in:
commit
261d18506f
@ -69,7 +69,7 @@ class PaymentReceived extends Notification
|
|||||||
|
|
||||||
// Attach the PDF file
|
// Attach the PDF file
|
||||||
if ($this->attach_pdf) {
|
if ($this->attach_pdf) {
|
||||||
$message->attach($this->storeInvoicePdfAndGetPath($this->invoice), [
|
$message->attach($this->storeDocumentPdfAndGetPath($this->invoice), [
|
||||||
'mime' => 'application/pdf',
|
'mime' => 'application/pdf',
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
@ -60,7 +60,7 @@ class Invoice extends Notification
|
|||||||
|
|
||||||
// Attach the PDF file
|
// Attach the PDF file
|
||||||
if ($this->attach_pdf) {
|
if ($this->attach_pdf) {
|
||||||
$message->attach($this->storeInvoicePdfAndGetPath($this->invoice), [
|
$message->attach($this->storeDocumentPdfAndGetPath($this->invoice), [
|
||||||
'mime' => 'application/pdf',
|
'mime' => 'application/pdf',
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
@ -124,17 +124,17 @@ trait Documents
|
|||||||
return $key;
|
return $key;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function storeInvoicePdfAndGetPath($invoice)
|
public function storeDocumentPdfAndGetPath($document)
|
||||||
{
|
{
|
||||||
event(new \App\Events\Document\DocumentPrinting($invoice));
|
event(new \App\Events\Document\DocumentPrinting($document));
|
||||||
|
|
||||||
$view = view($invoice->template_path, ['invoice' => $invoice])->render();
|
$view = view($document->template_path, ['invoice' => $document, 'document' => $document])->render();
|
||||||
$html = mb_convert_encoding($view, 'HTML-ENTITIES', 'UTF-8');
|
$html = mb_convert_encoding($view, 'HTML-ENTITIES', 'UTF-8');
|
||||||
|
|
||||||
$pdf = app('dompdf.wrapper');
|
$pdf = app('dompdf.wrapper');
|
||||||
$pdf->loadHTML($html);
|
$pdf->loadHTML($html);
|
||||||
|
|
||||||
$file_name = $this->getDocumentFileName($invoice);
|
$file_name = $this->getDocumentFileName($document);
|
||||||
|
|
||||||
$pdf_path = storage_path('app/temp/' . $file_name);
|
$pdf_path = storage_path('app/temp/' . $file_name);
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user