Skip to content

Controller

flashKeep()

flashKeep() — returns void

Available in: controller Category: Flash Functions

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.

NameTypeRequiredDefaultDescription
keystringno
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");