fix pdf kehadiran

This commit is contained in:
nurafrinaalimi16
2024-04-30 13:07:08 +08:00
parent c270f4306d
commit 032a1066ff
3 changed files with 39 additions and 28 deletions
+7 -11
View File
@@ -16,25 +16,21 @@ class KehadiranController extends Controller
public function index($id)
{
//
$kehadiranAll = $this->getKehadiranAll($id);
$totalkehadiranAll = Voter::where('kehadiran','!=', 0)->count();
$votes = Voter::where('election_id', $id)->count();
$voters = \App\Voter::where('election_id', $id)->get();
$pdf = App::make('dompdf.wrapper');
$pdf->loadView('report.kehadiran-pdf', compact('voters'));
$pdf->loadView('report.kehadiran-pdf', compact('voters', 'kehadiranAll', 'totalkehadiranAll', 'votes'));
return $pdf->stream();
}
protected function getKehadiranString($kehadiran)
private function getKehadiranAll($id)
{
// Map integer values to corresponding string representations
switch ($kehadiran) {
case 1:
return 'Fizikal';
case 2:
return 'Maya';
default:
return '-';
}
return \App\Voter::where('kehadiran','!=', 0)->get();
}
/**