this.session
You can access the current session manager via this.session
and it returns the object Illuminate\Session\Store
current session configuration.
# this.session.get()
You can retrieve data from the session by passing the key name to this.session.get
as the first argument.
{{ this.session.get('key') }}
You may also pass a default value as the second argument.
{{ this.session.get('key', 'default') }}
# this.session.has()
The this.session.has
method can determine if an item exists in the session.
{% if this.session.has('key') %}
<h1>We found key in the session</h1>
{% endif %}
# this.session.put()
The this.session.put
method is used to store session data.
{% do this.session.put('my-preference', 'value') %}
# this.session.forget()
The this.session.forget
will delete a single key (first argument) from the session.
{% do this.session.forget('key') %}
To remove all the session data, use this.session.flush
instead.
{% do this.session.flush() %}