Transaction event and notification changes..

This commit is contained in:
Cüneyt Şentürk
2021-06-30 10:51:52 +03:00
parent f9b5611611
commit 0fd2288116
8 changed files with 148 additions and 11 deletions

View File

@@ -88,4 +88,24 @@ trait Transactions
return $key;
}
public function storeTransactionPdfAndGetPath($transaction)
{
event(new \App\Events\Banking\TransactionPrinting($transaction));
$view = view($transaction->template_path, ['revenue' => $transaction, 'transaction' => $transaction])->render();
$html = mb_convert_encoding($view, 'HTML-ENTITIES', 'UTF-8');
$pdf = app('dompdf.wrapper');
$pdf->loadHTML($html);
$file_name = $this->getTransactionFileName($transaction);
$pdf_path = storage_path('app/temp/' . $file_name);
// Save the PDF file into temp folder
$pdf->save($pdf_path);
return $pdf_path;
}
}