Removing an item from the session after 5 minutes Laravel 9

Viewed 12

I am working on OTP based authentication system. I want to keep the OTP code in a session variable. and it must forget in 5 min in generating time. is it possible to use session or do need to use cookies?

 $otp_code = random_int(10000, 99999);

        session()->get('otp_code');
        session()->forget('otp_code');
        $session = Session::put('otp_code', $otp_code);
0 Answers
Related