hardcoded election_id on all kehadiran pages

This commit is contained in:
nurafrinaalimi16
2025-04-24 23:28:16 +08:00
parent 7539dbed25
commit 150d01975b
3 changed files with 57 additions and 108 deletions
+17 -8
View File
@@ -15,17 +15,26 @@ 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();
$electionId = 8; // fixed election ID
$totalkehadiranAll = Voter::where('election_id', $electionId)
->whereIn('kehadiran', [1, 2])
->count();
$votes = Voter::where('election_id', $electionId)->count();
$voters = Voter::where('election_id', $electionId)->get();
$pdf = App::make('dompdf.wrapper');
$pdf->loadView('report.kehadiran-pdf', compact('voters', 'kehadiranAll', 'totalkehadiranAll', 'votes'));
$pdf->loadView('report.kehadiran-pdf', compact(
'voters',
'totalkehadiranAll',
'votes'
));
return $pdf->stream();
}
private function getKehadiranAll($id)
{