Skip to content

Controller

flash()

flash() — returns any

Available in: controller Category: Flash Functions

Returns the value of a specific key in the Flash (or the entire Flash as a struct if no key is passed in).

NameTypeRequiredDefaultDescription
keystringno—The key to get the value for.
// 1. Get the current value of a specific key in the Flash
notice = flash("notice");
// notice -> "Your profile was updated successfully."

// 2. Get the entire Flash as a struct when no key is passed
flashContents = flash();
// flashContents -> {notice: "Record saved.", error: "Something went wrong."}

// 3. Check for a key before reading it to avoid an empty-string fallback
if (flashKeyExists("error")) {
    errorMessage = flash("error");
}