I have a table questions and a table question_options in my database and I want when the user clicks on the button play he will see a random question from the database to answer it, then press the next button and an another question must appear to him, although each question should appear in a 30 seconds. my tables :
Schema::create('questions', function (Blueprint $table) {
$table->increments('id');
$table->string('question_text');
$table->integer('points');
$table->integer('temps_reponse');
$table->integer('categories_id')->unsigned();
$table->foreign('categories_id')->references('id')->on('categories');
$table->integer('type_id')->unsigned();
$table->foreign('type_id')->references('id')->on('types');
$table->timestamps();
});
Schema::create('question_options', function (Blueprint $table) {
$table->increments('id');
$table->string('option_one');
$table->string('option_two');
$table->string('option_three');
$table->string('correcte');
$table->integer('question_id')->unsigned()->nullable();
$table->foreign('question_id')->references('id')->on('questions');
$table->timestamps();
});
Can anyone tell me how to solve this. Any help would be really appreciated, thanks much