当前位置: 首页>>代码示例>>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;未经允许,请勿转载。