Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

kxh's avatar
Level 1

Set time duration for a quiz app

Hello im trying to make a quiz app where users can take a quiz but have to finish it within a time frame. I have done the quiz creation part and user can join to complete the quiz but now im stuck on how to add time functionality. Can someone help me in this part?

public function store(StoreTopicRequest $request)
    {
        //
       

        $topic= Topic::create([
            'title' => $request->title,
            'no_question' => $request->question,
            'duration' => $request->duration
            
            
        ]);
       

        return redirect(route('topics.index'));
    }

This is where i store the quiz, but how can i use the duration so or to begin countdown??

0 likes
1 reply
putera's avatar
putera
Best Answer
Level 17

I think you need to create another table that store who join the quiz.

joined_quiz_table

  • id
  • user_id
  • quiz_id
  • join_datetime

Then you can do the countdown from the data in the table. Hope this gives you ideas. 👍🏻

Please or to participate in this conversation.