No, the user add stuff to the cart and when they go to checkout they need to login or register
You should use route group for checkout
Route::group(array('prefix'=>'checkout','before'=>'auth'),function(){
})
The problem comes after Auth that the Session::getId(); is different than before Auth::login
I tried also with
$old_sid = Session::getId();
Auth::login(Auth::user());
Session::setId($old_sid);
Session::save();
But the session id is not set back and still does not work
I think you should set session name after call session name, not set id.
Because after login session id has been change
i only can second what tuyenlaptrinh is saying. i'm using a session Cart and a session User
The problem is that my cart is not stored in the session, but in a database table that have a session_id column
When i get the cart i do something like
Cart::where('session_id',Session::getId())->get();
After login the Session::getId() is different, so i will need to change my cart logic now to use cookies
boksiora, I'm doing it just like you are. Storing the cart data in a Cart.php model. At this point, I'm working to add guest checkout, but preserve the cart-in-database approach. My plan is to do just as you're doing and adding a "session_id" column to that table.
Did you change your cart logic to use sessions only? Or did you keep it in the database?
I used Session::getId() to get the session id and after that i used Session::setId($sessid); to set the session id and Session::start(); to load the data.
hope it helps.
Sign in to participate in this thread!
The Laravel portal for problem solving, knowledge sharing and community building.
The community