Wish list without registering on the website?

There is a task to implement a wish list in the online store without registering the user.
Shop for Laravel 5.2. Prompt, please, where is better to store products added to the wish list?
In sessions or cookies? How?
And how to make it so that they were kept there as long as possible?

I understand that you can just increase the time of storage of sessions in the settings of Laravel.
But still, interested in how the pros do it? Online store make first time.
Thanks in advance.
July 9th 19 at 13:44
3 answers
July 9th 19 at 13:46
Solution
You can assign by clicking on the "add wish list" my session-cookie. She will authorize it in the future.
Caution: the user can edit the cookie on their side. Make a long random hash in a cookie, in order to reduce overlap with other users.

To store the selected products in the database - display the wish-products, comparing it with session-cookie - but this is undesirable: any mass flooding on the button "add to wishlist" with disabled cookies will flood your base a ton of non-existent records.
So, instead of authorization, you can easily store selected products in the cookie, without creating any sessions.

It should be understood that the user will not see your wishlist between devices, and in the future will lose its zeroing cook or switching to another browser.
July 9th 19 at 13:48
Solution
in the cookie - list to the desired user need - if not scary, you can just ID the product save - plain text comma-separated(or json) with the date added.
July 9th 19 at 13:50

Find more questions by tags ProgrammingPHPLaravelInternet shopsWeb Development