Level 4
i get the answer,
$pdf = PDF::loadView('report.issuedreportprint',compact('stockIssued','startdate ','enddate '));
in blade
<p> From:{{ $startdate }} To: {{ $enddate }} </p>
Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.
I have the function which requested start date and End date from my blade form, then it dowbload the report from that date range
so i want to display those date range start date and End date on top of second page
Controller
public function stockIssued(Request $request) {
$startdate=$request->startdate;
$enddate=$request->enddate;
//issued
$stockIssued=DB::select(DB::raw(" SELECT
products.id,
products.name,
(select ifnull(sum(loadings.qty),0) from loadings where loadings.pid=products.id and
DATE(loadings.created_at) BETWEEN STR_TO_DATE('$startdate','%m/%d/%Y') AND
STR_TO_DATE('$enddate','%m/%d/%Y') ) as total_loadings_specific_date
from products"));
$pdf = PDF::loadView('report.issuedreportprint',compact('stockIssued'));
return $pdf->download('issuedreport.pdf');
// return view('report.issuedreport',compact('stockIssued'));
//
}
My view Blade issuedreportprint
</head>
<body>
<?php
$startdate = $request->old('startdate');
$enddate = $request->old('enddate');
echo "<p>From:'$startdate' To:'$enddate'</p>"
?>
<table width="90%" border="1" align="center" style="margin-top: 20px;margin-bottom: 2px; margin-
left:10px; margin-right:10px; " >
<thead>
<tr>
<th>Items Name</th>
<th>Total Qty</th>
</tr>
</thead>
<tbody>
@foreach($stockIssued as $dt)
<tr>
<td>{{$dt->name}}</td>
<td>{{$dt->total_loadings_specific_date ??0 }}</td>
</tr>
@endforeach
</tbody>
</table>
</body>
</html>
i get the answer,
$pdf = PDF::loadView('report.issuedreportprint',compact('stockIssued','startdate ','enddate '));
in blade
<p> From:{{ $startdate }} To: {{ $enddate }} </p>
Please or to participate in this conversation.