Pash
Pash

Reputation: 381

How to change the lifetime of a Sentinel remember me cookie?

I have a laravel application which uses Sentinel for authentication. I want to change the lifetime of remember me cookie in Laravel. I want the cookie to expire after 5 days. Anyone experience with Sentinel, please help.

Thanks in advance

Upvotes: 0

Views: 307

Answers (1)

Mohammed Aktaa
Mohammed Aktaa

Reputation: 1353

you can make a new cookie with the same name of it and give it the value of it and the time you want it.

use this code and it will work with you.

$cookies=\Cookie::get();
$cookies_keys=array_keys(\Cookie::get());
$name='remember_web_';
$remember=collect($cookies_keys)->filter(function ($v) use ($name) {
   return preg_match("/$name/", $v);
});
$remember_me=$cookies[$remember->first()];
\Cookie::make("$remember",\Cookie::get("$remember"),'your_time');

Upvotes: 1

Related Questions