本文整理汇总了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]);
}
}
}