class Illuminate / Session / Store
You are viewing an older version of the documentation. For the latest, please visit master documentation.

Store

Implements

Properties

protected

$id string

The session ID.

Default: null
protected

$name string

The session name.

Default: null
protected

$attributes array

The session attributes.

Default: []
protected

$handler SessionHandlerInterface

The session handler implementation.

Default: null
protected

$started bool

Session store started status.

Default: false

Methods

public

__construct ( $name , SessionHandlerInterface $handler , $id ) : void

Create a new session instance.

Parameters

public

start ( ) : bool

Start the session, reading the data from a handler.

protected

loadSession ( ) : void

Load the session data from the handler.

protected

readFromHandler ( ) : array

Read the session data from the handler.

protected

prepareForUnserialize ( $data ) : string

Prepare the raw string data from the session for unserialization.

Parameters

  • $data string
public

save ( ) : void

Save the session data to storage.

protected

prepareForStorage ( $data ) : string

Prepare the serialized session data for storage.

Parameters

  • $data string
public

ageFlashData ( ) : void

Age the flash data for the session.

public

all ( ) : array

Get all of the session data.

public

only ( array $keys ) : array

Get a subset of the session data.

Parameters

  • $keys array
public

exists ( $key ) : bool

Checks if a key exists.

Parameters

  • $key string|array
public

missing ( $key ) : bool

Determine if the given key is missing from the session data.

Parameters

  • $key string|array
public

has ( $key ) : bool

Checks if a key is present and not null.

Parameters

  • $key string|array
public

get ( $key , $default ) : mixed

Get an item from the session.

Parameters

  • $key string
  • $default mixed
public

pull ( $key , $default ) : mixed

Get the value of a given key and then forget it.

Parameters

  • $key string
  • $default mixed
public

hasOldInput ( $key ) : bool

Determine if the session contains old input.

Parameters

  • $key string|null
public

getOldInput ( $key , $default ) : mixed

Get the requested item from the flashed input array.

Parameters

  • $key string|null
  • $default mixed
public

replace ( array $attributes ) : void

Replace the given session attributes entirely.

Parameters

  • $attributes array
public

put ( $key , $value ) : void

Put a key / value pair or array of key / value pairs in the session.

Parameters

  • $key string|array
  • $value mixed
public

remember ( $key , Closure $callback ) : mixed

Get an item from the session, or store the default value.

Parameters

public

push ( $key , $value ) : void

Push a value onto a session array.

Parameters

  • $key string
  • $value mixed
public

increment ( $key , $amount ) : mixed

Increment the value of an item in the session.

Parameters

  • $key string
  • $amount int
public

decrement ( $key , $amount ) : int

Decrement the value of an item in the session.

Parameters

  • $key string
  • $amount int
public

flash ( string $key , $value ) : void

Flash a key / value pair to the session.

Parameters

  • $key string
  • $value mixed
public

now ( $key , $value ) : void

Flash a key / value pair to the session for immediate use.

Parameters

  • $key string
  • $value mixed
public

reflash ( ) : void

Reflash all of the session flash data.

public

keep ( $keys ) : void

Reflash a subset of the current flash data.

Parameters

  • $keys array|mixed
protected

mergeNewFlashes ( array $keys ) : void

Merge new flash keys into the new flash array.

Parameters

  • $keys array
protected

removeFromOldFlashData ( array $keys ) : void

Remove the given keys from the old flash data.

Parameters

  • $keys array
public

flashInput ( array $value ) : void

Flash an input array to the session.

Parameters

  • $value array
public

remove ( $key ) : mixed

Remove an item from the session, returning its value.

Parameters

  • $key string
public

forget ( $keys ) : void

Remove one or many items from the session.

Parameters

  • $keys string|array
public

flush ( ) : void

Remove all of the items from the session.

public

invalidate ( ) : bool

Flush the session data and regenerate the ID.

public

regenerate ( $destroy ) : bool

Generate a new session identifier.

Parameters

  • $destroy bool
public

migrate ( $destroy ) : bool

Generate a new session ID for the session.

Parameters

  • $destroy bool
public

isStarted ( ) : bool

Determine if the session has been started.

public

getName ( ) : string

Get the name of the session.

public

setName ( $name ) : void

Set the name of the session.

Parameters

  • $name string
public

getId ( ) : string

Get the current session ID.

public

setId ( $id ) : void

Set the session ID.

Parameters

  • $id string
public

isValidId ( $id ) : bool

Determine if this is a valid session ID.

Parameters

  • $id string
protected

generateSessionId ( ) : string

Get a new, random session ID.

public

setExists ( $value ) : void

Set the existence of the session on the handler if applicable.

Parameters

  • $value bool
public

token ( ) : string

Get the CSRF token value.

public

regenerateToken ( ) : void

Regenerate the CSRF token value.

public

previousUrl ( ) : string|null

Get the previous URL from the session.

public

setPreviousUrl ( $url ) : void

Set the "previous" URL in the session.

Parameters

  • $url string
public

passwordConfirmed ( ) : void

Specify that the user has confirmed their password.

public

getHandler ( ) : SessionHandlerInterface

Get the underlying session handler implementation.

public

handlerNeedsRequest ( ) : bool

Determine if the session handler needs a request.

public

setRequestOnHandler ( $request ) : void

Set the request on the handler instance.

Parameters