how track sessionID for shopping cart table in laravel

Viewed 3695

I'm using php laravel 5.2 for my project. I want to design shopping cart with database table(table name is cart). cart table has column name session_id to determine each users cart.

the problems are:

  1. when user logged in session id will change and I lose cart for that user(and other conditions that sessionId will change).
  2. when session expired shopping cart still exist in database also it is not been use any more, how can I figure this out and delete these kind of carts?

or any other idea for shopping cart design with database?

2 Answers
Related