I am currently trying to implement a way to flash session data similarly to how Laravel deals with flash data. I am aware that Laravel override the native session methods that are getting called by functions like session_start.
They seem to do this with the Http foundation
package of Symfony by creating custom methods for open
, read
, write
, etc. for the session. This is done by using session_set_save_handler
:
http://php.net/manual/en/function.session-set-save-handler.php
By using that function you can implement your open logic for when you start a session or a session gets written to. But so far I can not find the direct logic in the Laravel codebase where flash data is being unset.
It would make sense to unset the flash data right before the write
functionality of the session. This way you would unset it for future requests and will be sure it will only happen at the termination of your code.
Could anybody tell me how Laravel deals with session flash messages?