I have two types of requirements.
1) Quiz with straight forward questions and multiple choice answer (single answer)
2) Quiz with reading comprehension with its set of questions and some assorted questions then passage again. (There is no particular order in which passages and random questions appear)
I have implemented task 1 by building the following tables.
Table( questions)
$table->integer('quiz_id')->index();
$table->integer('question_no')->index();
$table->text('question');
$table->text('quiz_ans_1');
$table->text('quiz_ans_2');
$table->text('quiz_ans_3');
$table->text('quiz_ans_4');
Table (answers)
$table->increments('id');
$table->integer('question_id');
$table->integer('quiz_id')->index();
$table->integer('question_no')->index();
$table->string('answer');
For normal straight forward quiz it works great as in blade template I can pull a question title and answers and run a "foreach" loop.
For task 2 ,I am confused where to put the reading comprehension passages in database and pull them in blade as described in test format which vary from exam to exam.
Few problems :-
1) If model "passages" with hasMany('App\Questions') is created. Then when I call a quiz and pull blade then it will show only passages and questions related to it and ignore . But there will be many single questions which needs to be pulled.
2) If model "questions" belongsTo Passage is created it is defining that every question belongs to some passage which is not the case.
I want to implement the following in a instance of online test :-
1) section 1 -> "n" number of questions which are independent
2) section 2 -> three reading comprehension passages with their own set of questions (numbers vary)
3) section 3 -> "m" questions which are independent
4) section 4 -> two reading comprehension passages with their own set of questions (numbers vary)
total questions (n+m+l)= 100 (or 200 which is fixed)
It would be great help if some can put me in right direction.