The default LoginController.php uses the trait AuthenticatesUsers.php
This contains
/**
* Send the response after the user was authenticated.
*
* @param \Illuminate\Http\Request $request
* @return \Illuminate\Http\Response
*/
protected function sendLoginResponse(Request $request)
{
$request->session()->regenerate();
$this->clearLoginAttempts($request);
return $this->authenticated($request, $this->guard()->user())
?: redirect()->intended($this->redirectPath());
}
my guess would be that $request->session()->regenerate(); creates a new session that does not have any of the data of the previous session.
I don't advise that you remove this but you could pull the data you need into the controller, regenerate the session and then store the session variables again.
Since the method above is in a trait, you can duplicate this code into your LoginController and then modify it, e.g.
LoginController.php
/**
* Send the response after the user was authenticated.
*
* @param \Illuminate\Http\Request $request
* @return \Illuminate\Http\Response
*/
protected function sendLoginResponse(Request $request)
{
$cart = session('cart');
$request->session()->regenerate();
session(['cart' => $cart]);
$this->clearLoginAttempts($request);
return $this->authenticated($request, $this->guard()->user())
?: redirect()->intended($this->redirectPath());
}