hardcoded election_id on all kehadiran pages
This commit is contained in:
@@ -6,8 +6,6 @@ use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Facades\App;
|
||||
use App\Voter;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
|
||||
|
||||
class FizikalController extends Controller
|
||||
{
|
||||
/**
|
||||
@@ -15,27 +13,33 @@ class FizikalController extends Controller
|
||||
*
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function index($id)
|
||||
public function index()
|
||||
{
|
||||
//
|
||||
$physicals = $this->getFizikalKehadiran($id);
|
||||
$total_physicals = Voter::where('kehadiran', 1)->count();
|
||||
$votes = Voter::where('election_id', $id)->count();
|
||||
$voters = \App\Voter::where('election_id', $id)->get();
|
||||
$electionId = 8;
|
||||
|
||||
// Get only voters who attended physically for election_id = 8
|
||||
$physicals = Voter::where('election_id', $electionId)
|
||||
->where('kehadiran', 1)
|
||||
->get();
|
||||
|
||||
// Total physical attendees
|
||||
$total_physicals = Voter::where('election_id', $electionId)
|
||||
->where('kehadiran', 1)
|
||||
->count();
|
||||
|
||||
// Total voters for the election
|
||||
$votes = Voter::where('election_id', $electionId)->count();
|
||||
|
||||
// All voters for the election
|
||||
$voters = Voter::where('election_id', $electionId)->get();
|
||||
|
||||
// Load PDF view
|
||||
$pdf = App::make('dompdf.wrapper');
|
||||
$pdf->loadView('report.fizikal', compact('physicals', 'voters','total_physicals','votes'));
|
||||
$pdf->loadView('report.fizikal', compact('physicals', 'voters', 'total_physicals', 'votes'));
|
||||
|
||||
return $pdf->stream();
|
||||
}
|
||||
|
||||
private function getFizikalKehadiran($id)
|
||||
{
|
||||
return \App\Voter::where('kehadiran', 1)->get();
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Show the form for creating a new resource.
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user