view = $view; $this->disk = $disk; $this->prepath = Storage::disk($disk)->path(''); } public function create($data, $name='test.pdf', $output='stream', $path = false){ header('Content-type: text/html; charset=UTF-8') ;//chrome //dd($data); $pdf = app('dompdf.wrapper'); $pdf->getDomPDF()->set_option("enable_php", true); $pdf->loadView($this->view, $data); $pdf->setPaper('A4', 'portrait'); if($output === 'stream'){ //file??? return $pdf->stream($name); } if($output === 'download'){ //download return $pdf->download($name); } if($output === 'save'){ if($path){ $pdf->save($path.$name); return $path.$name; } } } public function merger($dir, $filename, $template){ $pdfMerger = new MyPDFMerger(); $pdfMerger->addPDF($this->prepath.$dir.$filename); $file = $pdfMerger->myMerge('string', $filename, $template); Storage::disk($this->disk)->put($dir.$filename, $file); } public function setPrePath($path){ $this->prepath = $path; } } ?>