如何在Laravel中将多个数组/变量传递到DOMPDF中?

时间:2018-10-04 01:44:12

标签: arrays laravel pdf dompdf loadview

我尝试传递多个变量,一个数组和一个变量。这是我的代码:

tanggal_arsips  = $req->tanggal_arsip;
$nama_file  = "Laporan Pengarsipan[".$tanggal_arsips."].pdf";

$antrian    = DB::table("antrian_sp AS a")
                      ->select(array("a.tanggal as tanggal","a.noper as noper","a.nama as nama","b.nomor_paspor as nomor_paspor"))
                      ->join("data_pemohon AS b", "a.noper", "=", "b.noper")
                      ->join("arsip AS c", "a.noper", "=", "c.noper")
                      ->where("a.keterangan", "=", "1")
                      ->where("c.status_arsip", "=", "arsip")
                      ->whereDate("c.tanggal_arsip","=",$tanggal_arsips)
                      ->get();

$pdf    = PDF::loadView('coba',['antrian'=>$antrian, 'tanggal_arsips'=>$tanggal_arsips]);
return $pdf->download($nama_file);

然后尝试在视图中打印“ tanggal_arsips”变量,这是代码:

echo($tanggal_arsips)

问题是我无法打印变量“ tanggal_arsips”,它什么也没显示。有什么问题吗?,帮帮我。谢谢。

1 个答案:

答案 0 :(得分:0)

如果出现错误,错误消息是什么? 如果没有错误,则在加载PDF视图之前打印$ tanggal_arsips时,它显示任何内容吗?