Version: v0.7.1 - Beta.  We welcome contributors & feedback.

Session.getFlash

Session.getFlash($key, $default = '') -> any

Description

Retrieve the one-time value of the given $key set via Session.setFlash().

The value will then be removed from the session.

If the key does not yet exist, the $default value is returned.

// (after processing user action)

Session.setFlash('message', 'Congratulations!')


// ... in the NEXT request only ...

tm myTemplate {
    --- if Session.hasFlash('message') {
        <div>{{ Session.getFlash('message') }}</div>
    --- }
}
//= <div>Congratulations!</div>