this.session
Twig Property
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') }}
# this.session.has()
The this.session.has
method can eetermine if an item exists in the session.
{% if this.session.has('key') %}
<h1>We found key in the session</h1>
{% endif %}
# this.session.forget
The this.session.forget
will delete a single key (first argument) from the session.
{{ this.session.forget('key') }}
To remove all the session data, use this.session.flush
instead.
{{ this.session.flush() }}