I can’t export pdf in laravel with dompdf

  dompdf, jquery, laravel, php

Here is the function that I am trying to create the PDF

public function generar_pdf(Request $request){

$num_cont_vale = $request->get('num_cont_vale');
$fecha_inicial = $request->get('fecha_inicial');
$fecha_final   = $request->get('fecha_final');
$dni           = $request->get('dni');
$num_patente   = $request->get('num_patente');
$cod_obra      = $request->get('cod_obra'); 
$origen        = $request->get('origen');
$destino       = $request->get('destino');
$material      = $request->get('material');



   ->whereHas('canteras', function ($query) use ($material) {
    if($material){ 
        $query->where('material', 'LIKE', "$material");
      }
   })

    $data = [
 
        'comisiones'=> $comisiones,
  
    ];
    dd($data);
     // view
     $pdf = PDF::loadView('pdf.comisionesdni', $data);
     return $pdf->stream('comisionesdni.pdf');
}

I need to print the data to the blade view but the data passes null

Source: Laravel

Leave a Reply