Laravel session() issue

Problem: After storing a session using session() helper, other pages cannot retrieve data from session. The solution is remove “exit();” in the same function because session is saved very late.

  1. Don’t need to add session_start() manually.
  2. Don’t stop the process using “exit()” or “die()” after storing a session because session could be not saved yet.
  3. session won’t work in construct because middleware is not ready yet.

Child class:

Parent Class: