Controller
flashKeep()
Signature
Section titled “Signature”flashKeep() — returns void
Available in: controller
Category: Flash Functions
Description
Section titled “Description”The flashKeep() function allows you to preserve Flash data for one additional request. By default, Flash values are only available for the very next request; calling flashKeep() prevents them from being cleared after the current request. You can choose to keep the entire Flash or only specific keys. This is useful when you want messages or temporary data to persist through multiple redirects or page loads.
Parameters
Section titled “Parameters”| Name | Type | Required | Default | Description |
|---|---|---|---|---|
key | string | no | — |
Examples
Section titled “Examples”1. Keep the entire Flash for the next request
flashKeep();
2. Keep the "error" key in the Flash for the next request
flashKeep("error");
3. Keep both the "error" and "success" keys in the Flash for the next request
flashKeep("error,success");