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());
Advertisement
Answer
As far as I know, you can do it. I’ve checked this just in case:
Session::flash('test', array('test1', 'test2', 'test3')); ... After the request dd(Session::get('test')); // array(2) { [0]=> string(5) "test1" [1]=> string(5) "test2" [2]=> string(5) "test3" }
It works. Also you can serialize an array or object as Christopher Morrissey just commented