當前位置: 首頁>>代碼示例>>PHP>>正文


PHP quiz::where方法代碼示例

本文整理匯總了PHP中quiz::where方法的典型用法代碼示例。如果您正苦於以下問題:PHP quiz::where方法的具體用法?PHP quiz::where怎麽用?PHP quiz::where使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在quiz的用法示例。


在下文中一共展示了quiz::where方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: round

 public function round($id)
 {
     $utoken = session('user_id');
     $maxround = leaderboard::where('user_id', $utoken)->select('round_id')->first();
     $maxround = $maxround['round_id'];
     $cc = leaderboard::where('round_id', '>', $id)->count();
     $quesquery = solved::where(['user_token' => $utoken, 'round_id' => $id])->select('question_no')->get();
     $totalques = quiz::where('round', $id)->select('question_id', 'position')->get();
     $rquery = roundans::where('round_id', $id)->select('question', 'round_name')->first();
     $rq = $rquery['question'];
     $rname = $rquery['round_name'];
     $qdone = array();
     $i = 0;
     foreach ($quesquery as $ques) {
         $qdone[$i] = $ques['question_no'];
         $i++;
     }
     $i = 0;
     $i2 = 0;
     $parray = array();
     $tques = array();
     $totpos = array();
     $location = array();
     foreach ($totalques as $t) {
         $tques[$i2] = $t['question_id'];
         $totpos[$i2] = $t['position'];
         if (in_array($tques[$i2], $qdone)) {
             $parray[$i] = explode(",", $t['position']);
             $location[$i] = $t['position'];
             $i++;
         }
         $i2++;
     }
     if ($id > $maxround || $id < 1) {
         return redirect(url('/round/' . $maxround));
     } else {
         if ($id > $this->mxround) {
             return view('quiz/winner')->with('id', $id);
         } else {
             return view('quiz/round')->with(['id' => $id, 'qdone' => $qdone, 'pos' => $location, 'totalques' => $tques, 'totalpos' => $totpos, 'rq' => $rq, 'rname' => $rname, 'c' => $cc, 'locations' => $parray]);
         }
     }
 }
開發者ID:arka-nitd,項目名稱:quiz-laravel,代碼行數:43,代碼來源:QuizController.php


注:本文中的quiz::where方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。