Commit 5eb379d6 authored by Taylor Otwell's avatar Taylor Otwell

Refactoring the session class.

parent 15328afa
...@@ -52,22 +52,18 @@ class Session { ...@@ -52,22 +52,18 @@ class Session {
} }
/** /**
* Load the session for the user. * Load a user session by ID.
* *
* @param string $id
* @return void * @return void
*/ */
public static function load() public static function load($id)
{ {
if ( ! is_null($id = Cookie::get('laravel_session'))) static::$session = ( ! is_null($id)) ? static::driver()->load($id) : null;
{
static::$session = static::driver()->load($id);
}
// If the session is invalid or expired, start a new one. if (is_null(static::$session) or static::expired(static::$session['last_activity']))
if (is_null($id) or is_null(static::$session) or static::expired(static::$session['last_activity']))
{ {
static::$session['id'] = Str::random(40); static::$session = array('id' => Str::random(40), 'data' => array());
static::$session['data'] = array();
} }
if ( ! static::has('csrf_token')) if ( ! static::has('csrf_token'))
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment