Hi,
it's a really strange thing. If i output session()->getId() on my /cart page in my CartController in the __construct, it changes on every request. Additionally i output it on the index-method, it stays the same (as it should). Any ideas why this happens?
Here is the example code snippet that's relevant:
class CartController
{
public function __construct()
{
\Debugbar::info('session()->getId() in CartController::construct '.session()->getId());
}
public function index()
{
\Debugbar::info('session()->getId() in CartController::index '.session()->getId());
return 'index';
}
}
Here is the result for 3 request:
Request 1
session()->getId() in CartController::construct XyFBsUvi9GTrl7JKVJmVbuumaVP7BHV09iIj1X7L
session()->getId() in CartController::index cBdeAHMCKLWZmfS3Vb1Ji2ZPpqeJctj5IAqRYuaV
Request 2
session()->getId() in CartController::construct WyK1QzcCfEd88wVYYYf61D79UyE1h9Xj6cMDkCKl
session()->getId() in CartController::index cBdeAHMCKLWZmfS3Vb1Ji2ZPpqeJctj5IAqRYuaV
Request 3
session()->getId() in CartController::construct 1rXdH7K88VJMtslHl7d1ZVlTgHH8ajeZjbMyxztj
session()->getId() in CartController::index cBdeAHMCKLWZmfS3Vb1Ji2ZPpqeJctj5IAqRYuaV
As you can see, the one in the index method is always the same. And in the constructor it changes on each request. Am i missing something? Don't get it why this happens.
PS: Laravel 5.5