コード例 #1
0
ファイル: AdminController.php プロジェクト: evotehimit/e_vote
 public function dashboard(Request $request)
 {
     $hak_akses = 0;
     $data = Candidate::all();
     if ($request->session()->has('admin')) {
         return view('admin.dashboard', compact('data', 'hak_akses'));
     } else {
         return redirect()->action('LoginAdminController@getlogin');
     }
 }
コード例 #2
0
 public function index()
 {
     $candidates = Candidate::all();
     return view('dashboard.allCandidates')->with('candidates', $candidates);
 }
コード例 #3
0
 public function countVote()
 {
     $candidates = Candidate::all();
     $labels = array();
     $viewDataset = array();
     foreach ($candidates as $candidate) {
         array_push($labels, $candidate->first_name . " " . $candidate->last_name . " (" . $candidate->getVoteCount() . ") ");
         array_push($viewDataset, $candidate->getVoteCount());
     }
     $viewData = array('labels' => $labels, 'datasets' => array(array('label' => "# of votes", 'fillColor' => "rgba(255, 206, 86, 0.2)", 'strokeColor' => "rgba(255, 206, 86, 0.2)", 'highlightFill' => "rgba(255, 206, 86, 0.2)", 'highlightStroke' => "rgba(220,220,220,1)", 'backgroundColor' => "rgba(75, 192, 192, 0.2)", 'borderColor' => "rgba(75, 192, 192, 1)", 'borderWidth' => "1", 'data' => $viewDataset)));
     return json_encode($viewData);
 }