/** * Display a listing of the resource. * * @return Response */ public function index() { //$votes = Response::json(Vote::all()); $err = ''; $votes = Vote::get(); return View::make('tasks.index2', compact('votes', 'err')); }
// Route::get('t', 'CandidateController@create'); // Route::get('t2', 'CandidateController@store_a'); Route::get('excel', ['as' => 'import_cadidates', 'uses' => 'CandidateController@create']); Route::get('excel_value', ['as' => 'import_cadidates_value', 'uses' => 'CandidateController@create']); Route::get('store_a', ['as' => 'store_cadidates', 'uses' => 'CandidateController@store_a']); //Route::get('/passsec/', ['as' => 'passsec', 'uses' => 'VoteController@passsec']); Route::post('file_import', ['as' => 'file_import', 'uses' => 'CandidateController@file_move']); Route::get('candidates_index', ['as' => 'cadidates', 'uses' => 'CandidateController@index']); //Route::get('/', ['as' => 'home']); Route::get('/{id}', array('as' => 'vote.edit', function ($id) { // return our view and Vote information return View::make('tasks.vote-edit')->with('vote', Vote::find($id)); }))->where('id', '[0-9]+'); Route::get('/manage', array('as' => 'manage', function () { $time_now = Carbon::now(); $votes = Vote::get(); $ary[0] = $votes; foreach ($ary[0] as $vote) { // $candidate = Candidate::find($vote->id); $candidate_c = Candidate::where('vote_id', '=', $vote->id)->first(); if ($candidate_c != null) { $ary[1][$vote->id] = $candidate_c->vote_id; } else { $ary[1][$vote->id] = '沒有資料'; } } // return our view and Vote information return View::make('tasks.vote-manage-index', compact('ary', 'time_now')); })); Route::get('/candidate_data_show/{id}', array('as' => 'candidate_data_show', function ($id) { $candidates = Candidate::where('vote_id', '=', $id)->get();