In my controller im trying to redirect back with a Flash message in laravel 5. This all works great. The problem is no matter how i set it up the flash message always re-app
You can show flash messages using javascript and use SessionStorage
to stop repeating messages. Browser cache doesn't know if browser already shown a message, but we can use SessionStorage
to check it before display.
...
var popupId = "{{ uniqid() }}";
if(sessionStorage) {
// prevent from showing if it exists in a storage (shown);
if(!sessionStorage.getItem('shown-' + popupId)) {
$('#flash-container').append("{{ session('status') }}");
}
sessionStorage.setItem('shown-' + popupId, '1');
}