this.session

October CMS Documentation Docs

This article is for an old version of the documentation. View Latest Version →

this.session

You can access the current session manager via this.session and it returns the object Illuminate\Session\SessionManager current session configuration.

# Storing data in the session

{{ this.session.put('key', 'value') }}
Copied!

# Retrieving data from the session

{{ this.session.get('key') }}
Copied!

# Determining if an item exists in the session

{% if this.session.has('key') %}
    <h1>we found it in the session</h1>
{% endif %}
Copied!

# Deleting data from the session

# Remove data for a single key

{{ this.session.forget('key') }}
Copied!

# Remove all session data

{{ this.session.flush() }}
Copied!