In this video we are going to learn about Wishlist Using Database.
This time we are using session for storing the Wishlist item.
If I add some product to Wishlist and now lets logout.
Then lets login again with same user credential and here you can see after logout Wishlist is empty.
So lets see how can we store the wishlist item into table which are not removed even after logout.
In previous tutorial we have created this migration for the cart.
Now lets use this for storing the wihslist item also.
For that go to the ShopComponent.php Class file inside the render method add the following code.


Now for restoring the Wishlist go to the HomeComponent.php class file and inside the render method write the following code.


All set now save files and lets check it.
So switch to browser and refresh the page.
And lets login with user credential.
Now lets add some item to the Wishlist.
After adding some product to the Wishlist lets logout.
After logout you can see Wishlist is empty.
Now lets login again with same user credential.
And after login you can get the all Wishlisted item back.
So in this way you can Create Wishlist Using Database