I am getting question randomly by using the following method:
public function mcq($id)
{
$questions = Chapter::find($id)->questions()->orderByRaw("RAND()")->paginate(1);
return view('pages.mcq')->withQuestions($questions);
}
How can avoid repeat questions.
paginate(1)will always return a single question, so how could there possibly be duplicates?