Teoman Tıngır
Teoman Tıngır

Reputation: 2866

How to do give expire time to specific session in laravel 5.6 ?

I want to create session and it should be remove at 3 days later.

How do I do that ? I checked out the documents and questions in here, but found nothing..

-what I want exactly ?

session()->put("suspect",true,strtotime($time_diff))

is that possible ?

Upvotes: 1

Views: 1386

Answers (1)

Siva Ganesh
Siva Ganesh

Reputation: 1445

$_SESSION['expire'] = time() + 259200; // 3 days

if(time() > $_SESSION['expire'])
{  

 session_unset();
 session_destroy(); 

}

Upvotes: 1

Related Questions