Advertisement
kura2yamato

laravel export pdf

Jul 27th, 2022
1,203
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.44 KB | None | 0 0
  1. Route:
  2. Route::get('/siswa/export_pdf', 'SiswaController@pdf_siswa');
  3.  
  4. controller:
  5. use PDF;
  6.  
  7. class SiswaController extends Controller
  8. {
  9.     public function pdf_siswa()
  10.     {
  11.         //echo "storage:".storage_path();
  12.         //echo "storage:".public_path();
  13.         //die;
  14.         $show=[];
  15.         $pdf = PDF::loadView('siswa.pdf', compact('show'));
  16.        
  17.         return $pdf->download('contoh.pdf');
  18.     }
  19. }
  20.  
  21. view
  22.  
  23.   <img src="{{public_path().'/contoh.jpg'}}" />
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement