fix pdf kehadiran
This commit is contained in:
@@ -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();
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user