Skip to content

Instantly share code, notes, and snippets.

$questions = Question::inRandomOrder()->limit(10)->get();
dd($questions->paginate(1));
SQLSTATE[42S22]: Column not found: 1054 Unknown column 'user_questions' in 'field list' (SQL: update `questions` set `updated_at` = 2018-03-26 17:05:45, `user_questions` = where `id` = 67)
public function index(Request $request)
{
$questionsIds = Question::whereHas('questionMapper', function ($q) use ($request) {
$q->where('category_id', $request->jcategory_id);
$q->where('designation_id', $request->designation_id);
$q->where('department_id', $request->department_id);
})->with('questionMapper.questionCategory')->inRandomOrder()->get();
// $userQuestionCollection = [];
array:4 [▼
0 => array:3 [▼
"query" => "select * from `questions` where exists (select * from `question_mappers` where `question_mappers`.`question_id` = `questions`.`id` and `category_id` = ? and `designation_id` = ? and `department_id` = ?) and `questions`.`deleted_at` is null order by RAND()"
"bindings" => array:3 [▼
0 => "3"
1 => "1"
2 => "1"
]
"time" => 6.02
]
@section('head')
<script>
var sessionMessage = <?php echo json_encode(Session::get('head_message')); ?>
</script>
<script src="{{ asset('js/message.js') }}"></script>
@endsection
Unexpected token (near goodAnswerCount), Unexpcted token (near correct_choice) and unrecognised keyword (near CASE)