Methods summary
public
|
|
public
|
#
load( string $id )
Load the session for the current request.
Load the session for the current request.
Parameters
|
protected static
boolean
|
#
expired( array $session )
Determine if the session payload instance is valid.
Determine if the session payload instance is valid.
The session is considered valid if it exists and has not expired.
Parameters
Returns
boolean
|
public
boolean
|
#
has( string $key )
Determine if the session or flash data contains an item.
Determine if the session or flash data contains an item.
Parameters
Returns
boolean
|
public
mixed
|
#
get( string $key, mixed $default = null )
Get an item from the session.
Get an item from the session.
The session flash data will also be checked for the requested item.
$name = Session::get('name');
$name = Session::get('name', 'Taylor');
Parameters
- $key
string $key
- $default
mixed $default
Returns
mixed
|
public
|
#
put( string $key, mixed $value )
Write an item to the session.
Write an item to the session.
Session::put('name', 'Taylor');
Parameters
- $key
string $key
- $value
mixed $value
|
public
|
#
flash( string $key, mixed $value )
Write an item to the session flash data.
Write an item to the session flash data.
Flash data only exists for the current and next request to the
application.
Session::flash('name', 'Taylor');
Parameters
- $key
string $key
- $value
mixed $value
|
public
|
#
reflash( )
Keep all of the session flash data from expiring after the request.
Keep all of the session flash data from expiring after the request.
|
public
|
#
keep( string|array $keys )
Keep a session flash item from expiring at the end of the request.
Keep a session flash item from expiring at the end of the request.
Session::keep('name');
Session::keep(array('name', 'email'));
Parameters
|
public
|
#
forget( string $key )
Remove an item from the session data.
Remove an item from the session data.
Parameters
|
public
|
#
flush( )
Remove all of the items from the session.
Remove all of the items from the session.
The CSRF token will not be removed from the session.
|
public
|
#
regenerate( )
Assign a new, random ID to the session.
Assign a new, random ID to the session.
|
public
string
|
#
token( )
Get the CSRF token that is stored in the session data.
Get the CSRF token that is stored in the session data.
Returns
string
|
public
integer
|
#
activity( )
Get the last activity for the session.
Get the last activity for the session.
Returns
integer
|
public
|
#
save( )
Store the session payload in storage.
Store the session payload in storage.
This method will be called automatically at the end of the request.
|
public
|
#
sweep( )
Clean up expired sessions.
Clean up expired sessions.
If the session driver is a sweeper, it must clean up expired sessions from
time to time. This method triggers garbage collection.
|
protected
|
#
age( )
Age the session flash data.
Age the session flash data.
|
protected
|
#
cookie( array $config )
Send the session ID cookie to the browser.
Send the session ID cookie to the browser.
Parameters
|