Fewo PDF Hinweise, Generator, Anhang Mail

This commit is contained in:
Kevin Adametz 2020-06-29 12:23:21 +02:00
parent a3bef8d1aa
commit 730832c8e1
31 changed files with 1786 additions and 147 deletions

View file

@ -0,0 +1,60 @@
<?php
namespace App\Services;
use App\Libraries\CouponPDF;
use App\Models\Coupon;
class CreatePDF{
protected $view;
protected $pdf;
public function __construct($view)
{
$this->view = $view;
}
public function create($fewo, $contents, $name='test.pdf', $output='stream'){
header('Content-type: text/html; charset=UTF-8') ;//chrome
//dd($data);
$data = [
'contents' => $contents,
'fewo' => $fewo,
];
$pdf = app('dompdf.wrapper');
$pdf->getDomPDF()->set_option("enable_php", true);
$pdf->loadView($this->view, $data);
$pdf->setPaper('A4', 'portrait');
if($output === 'stream'){
return $pdf->stream($name);
}
if($output === 'download'){
return $pdf->download($name);
}
if($output === 'save'){
/* $dir = $invoice->getInvoiceStorageDir();
if(!Storage::disk('invoices')->exists( $dir )){
Storage::disk('invoices')->makeDirectory($dir); //creates directory
}
$path = Storage::disk('invoices')->getAdapter()->getPathPrefix();
if($preview){
$filename = "preview.pdf";
}else{
$filename = $invoice->invoice_number.".pdf";
}
$pdf->save($path.$dir.$filename);
return $path.$dir.$filename; */
//return $pdf->download($name);
}
}
}
?>