-
Notifications
You must be signed in to change notification settings - Fork 5
Session
use Aweb\Nexus\Session;
Any non bulk accessor or mutator method can be used with dot notation key for nested data (Session::get('foo.bar')
)
Session class is actually manipulating with the original OpenCart registry Session object.
The Session::has
method checks if an attribute is defined on session, eq OpenCart array_key_exists($session->data, $key)
The Session::get
method returns an attribute, eq OpenCart $session->data[$key]
The Session::set
method sets an attribute on session, eq OpenCart $session->data[$key] = $value
The Session::put
method sets an attribute on session, eq OpenCart $session->data[$key] = $value
The Session::pull
method retrieve an attribute then remove it from session
The Session::increment
method if your session data contains an integer you wish to increment or decrement, returns result. if no session key is defined, it initiate it as 0 then apply the operation.
The Session::decrement
method if your session data contains an integer you wish to increment or decrement, returns result. if no session key is defined, it initiate it as 0 then apply the operation.
The Session::all
method returns attributes.
The Session::forget
method Removes an attribute.
The Session::flush
method clears all attributes. if $names are given, clear only them
The Session::getId
method get session id
The Session::getName
method get session name
The Session::getFlashBag
method returns Flash bag
The Session::flash
method To persist your flash data only for the current request. Sometimes you may wish to store items in the session for the next request. You may do so using the flash method. Data stored in the session using this method will be available immediately and during the subsequent HTTP request. After the subsequent HTTP request, the flashed data will be deleted. Flash data is primarily useful for short-lived status messages:
$request->session()->flash('status', 'Task was successful!');
The Session::reflash
If you need to persist your flash data for several requests, you may use the reflash method, which will keep all of the flash data for an additional request.
$request->session()->reflash();
The Session::keep
method if you only need to keep specific flash data (move them from _flash to permanent)