I have been looking around for a way of doing this. I know it is possible to store an array in the session with the following: Session::push('user.teams', 'developers');
Is it possible to do the same but with flash data? Something like Session::flashpush('user.teams', array('developers', 'designers'));
would be great.
The usecase for me at this moment is primarily the following:
Session::flash('flash_message', $validator->messages());
Summary. Flashing data to the session stores short-lived data and can display it in the application. It is usually used to display status after an action. RELATED TAGS. laravel.
Sessions are used to store information about the user across the requests. Laravel provides various drivers like file, cookie, apc, array, Memcached, Redis, and database to handle session data. By default, file driver is used because it is lightweight. Session can be configured in the file stored at config/session.
Laravel session configuration is stored in config/session. php file. By default, Laravel store session data in files. If you want to store session in database table, then change session driver to database and run bellow command to generate sessions table.
I use this:
Session::flash($key, array_merge((array)Session::get($key), array($value)));
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With