コード例 #1
0
ファイル: FrontController.php プロジェクト: marionj/wequizz
 /**
  * Affiche la liste des gagnants/meilleurs joueurs
  */
 public function winners(Request $request)
 {
     $quizz = Quizz::where('status', 2)->first();
     if (is_null($quizz)) {
         return redirect(route('front.index'));
     } else {
         $idQuizz = $quizz->id;
         $winners = Game::where('id_quizz', $idQuizz)->select()->orderBy('id_facebook', 'desc')->get();
         $winners_order = array();
         foreach ($winners as $key => $value) {
             $one = Game::select()->where('id_facebook', $value['id_facebook'])->where('id_quizz', $idQuizz)->orderBy('score')->first()->toArray();
             if (array_search($value['id_facebook'], $winners_order)) {
                 echo 'déjààà';
             } else {
                 array_push($winners_order, $one);
             }
         }
         var_dump($winners_order);
         return view('front.winners', array('pageName' => 'winners', 'winners' => $winners, 'quizz' => $quizz));
     }
 }