109 lines
2.4 KiB
PHP
109 lines
2.4 KiB
PHP
<?php
|
|
|
|
namespace App\Http\Controllers;
|
|
|
|
use Illuminate\Http\Request;
|
|
use Illuminate\Support\Facades\App;
|
|
use App\Voter;
|
|
use Illuminate\Support\Facades\DB;
|
|
class FizikalController extends Controller
|
|
{
|
|
/**
|
|
* Display a listing of the resource.
|
|
*
|
|
* @return \Illuminate\Http\Response
|
|
*/
|
|
public function index()
|
|
{
|
|
$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'));
|
|
|
|
return $pdf->stream();
|
|
}
|
|
|
|
/**
|
|
* Show the form for creating a new resource.
|
|
*
|
|
* @return \Illuminate\Http\Response
|
|
*/
|
|
public function create()
|
|
{
|
|
//
|
|
}
|
|
|
|
/**
|
|
* Store a newly created resource in storage.
|
|
*
|
|
* @param \Illuminate\Http\Request $request
|
|
* @return \Illuminate\Http\Response
|
|
*/
|
|
public function store(Request $request)
|
|
{
|
|
//
|
|
}
|
|
|
|
/**
|
|
* Display the specified resource.
|
|
*
|
|
* @param int $id
|
|
* @return \Illuminate\Http\Response
|
|
*/
|
|
public function show($id)
|
|
{
|
|
//
|
|
}
|
|
|
|
/**
|
|
* Show the form for editing the specified resource.
|
|
*
|
|
* @param int $id
|
|
* @return \Illuminate\Http\Response
|
|
*/
|
|
public function edit($id)
|
|
{
|
|
//
|
|
}
|
|
|
|
/**
|
|
* Update the specified resource in storage.
|
|
*
|
|
* @param \Illuminate\Http\Request $request
|
|
* @param int $id
|
|
* @return \Illuminate\Http\Response
|
|
*/
|
|
public function update(Request $request, $id)
|
|
{
|
|
//
|
|
}
|
|
|
|
/**
|
|
* Remove the specified resource from storage.
|
|
*
|
|
* @param int $id
|
|
* @return \Illuminate\Http\Response
|
|
*/
|
|
public function destroy($id)
|
|
{
|
|
//
|
|
}
|
|
}
|