small layout changes and added time stamp in session to set time limit on test
This commit is contained in:
parent
bde382c1ff
commit
40aa77386b
22 changed files with 40 additions and 92 deletions
app/Http/Controllers
|
@ -15,11 +15,15 @@ class TestController extends Controller
|
|||
{
|
||||
public function startTest(Test $test)
|
||||
{
|
||||
if (null !== session("start_time") && session("start_time")+3600 > time()) {
|
||||
return redirect()->action('TestController@showQuestion');
|
||||
}
|
||||
|
||||
if (Auth::user()->testTaken($test->id)) {
|
||||
//insert session flash
|
||||
return redirect('/home');
|
||||
}
|
||||
session(['questions' => $test->randomizeQuestions(), 'question_counter' => 1, 'test' => $test, 'wrong_answers' => 0, 'is_correct' => false, 'has_failed' => false, 'last_question' => false]);
|
||||
session(['questions' => $test->randomizeQuestions(), 'question_counter' => 1, 'test' => $test, 'wrong_answers' => 0, 'is_correct' => false, 'has_failed' => false, 'last_question' => false, 'start_time' => time()]);
|
||||
return redirect()->action('TestController@showQuestion');
|
||||
}
|
||||
|
||||
|
|
Reference in a new issue