Refactor session class.
This commit is contained in:
parent
c19ab70a0f
commit
7e28433a61
|
@ -194,17 +194,19 @@ public static function close()
|
||||||
|
|
||||||
static::driver()->save(static::$session);
|
static::driver()->save(static::$session);
|
||||||
|
|
||||||
|
$config = Config::get('session');
|
||||||
|
|
||||||
if ( ! headers_sent())
|
if ( ! headers_sent())
|
||||||
{
|
{
|
||||||
$minutes = (Config::get('session.expire_on_close')) ? 0 : Config::get('session.lifetime');
|
$minutes = ($config['expire_on_close']) ? 0 : $config['lifetime'];
|
||||||
|
|
||||||
Cookie::put('laravel_session', static::$session['id'], $minutes, Config::get('session.path'), Config::get('session.domain'), Config::get('session.https'), Config::get('session.http_only'));
|
Cookie::put('laravel_session', static::$session['id'], $minutes, $config['path'], $config['domain'], $config['https'], $config['http_only']);
|
||||||
}
|
}
|
||||||
|
|
||||||
// 2% chance of performing session garbage collection...
|
// 2% chance of performing session garbage collection...
|
||||||
if (mt_rand(1, 100) <= 2)
|
if (mt_rand(1, 100) <= 2)
|
||||||
{
|
{
|
||||||
static::driver()->sweep(time() - (Config::get('session.lifetime') * 60));
|
static::driver()->sweep(time() - ($config['lifetime'] * 60));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue