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

Session

Methods

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

start ( ) : bool

Start the session, reading the data from a handler.

public

save ( ) : void

Save the session data to storage.

public

all ( ) : array

Get all of the session data.

public

exists ( $key ) : bool

Checks if a key exists.

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

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

token ( ) : string

Get the CSRF token value.

public

regenerateToken ( ) : void

Regenerate the CSRF token value.

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

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

getHandler ( ) : SessionHandlerInterface

Get the session handler instance.

public

handlerNeedsRequest ( ) : bool

Determine if the session handler needs a request.

public

setRequestOnHandler ( $request ) : void

Set the request on the handler instance.

Parameters