LaravelSessionPayload

Summary

No protected properties found
N/A
No private methods found
No private properties found
N/A
File
sessionpayload.php
Package
Default
Class hierarchy
LaravelSessionPayload

Tags

None found

Properties

$session

$session : array

The session array that is stored by the driver.

Type

array

Tags

None found

$driver

$driver : \Laravel\Session\Drivers\Driver

The session driver used to retrieve and store the session payload.

Type

LaravelSessionDriversDriver

Tags

None found

$exists

$exists : boolean

Indicates if the session already exists in storage.

Type

boolean

Tags

None found

Methods

__construct()

__construct(\Laravel\Session\Drivers\Driver  $driver) : void

Create a new session payload instance.

Parameters

LaravelSessionDriversDriver $driver

Tags

None found

load()

load(string  $id) : void

Load the session for the current request.

Parameters

string $id

Tags

None found

has()

has(string  $key) : boolean

Determine if the session or flash data contains an item.

Parameters

string $key

Returns

boolean

Tags

None found

get()

get(string  $key, mixed  $default = null) : mixed

Get an item from the session.

The session flash data will also be checked for the requested item.

// Get an item from the session $name = Session::get('name');

// Return a default value if the item doesn't exist
$name = Session::get('name', 'Taylor');

Parameters

string $key
mixed $default

Returns

mixed

Tags

None found

put()

put(string  $key, mixed  $value) : void

Write an item to the session.

// Write an item to the session payload Session::put('name', 'Taylor');

Parameters

string $key
mixed $value

Tags

None found

flash()

flash(string  $key, mixed  $value) : void

Write an item to the session flash data.

Flash data only exists for the current and next request to the application.

// Write an item to the session payload's flash data Session::flash('name', 'Taylor');

Parameters

string $key
mixed $value

Tags

None found

reflash()

reflash() : void

Keep all of the session flash data from expiring after the request.

Tags

None found

keep()

keep(string|array  $keys) : void

Keep a session flash item from expiring at the end of the request.

// Keep the "name" item from expiring from the flash data Session::keep('name');

// Keep the "name" and "email" items from expiring from the flash data
Session::keep(array('name', 'email'));

Parameters

string|array $keys

Tags

None found

forget()

forget(string  $key) : void

Remove an item from the session data.

Parameters

string $key

Tags

None found

flush()

flush() : void

Remove all of the items from the session.

The CSRF token will not be removed from the session.

Tags

None found

regenerate()

regenerate() : void

Assign a new, random ID to the session.

Tags

None found

token()

token() : string

Get the CSRF token that is stored in the session data.

Returns

string

Tags

None found

activity()

activity() : integer

Get the last activity for the session.

Returns

integer

Tags

None found

save()

save() : void

Store the session payload in storage.

This method will be called automatically at the end of the request.

Tags

None found

sweep()

sweep() : void

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.

Tags

None found

expired()

expired(array  $session) : boolean

Determine if the session payload instance is valid.

The session is considered valid if it exists and has not expired.

Parameters

array $session

Returns

boolean

static

Tags

None found

age()

age() : void

Age the session flash data.

Tags

None found

cookie()

cookie(array  $config) : void

Send the session ID cookie to the browser.

Parameters

array $config

Tags

None found