►Laravel 11 Tutorial (with MongoDB): • Laravel 11 Tutorial (with MongoDB)
This is Part 56 of the Laravel 11 Tutorial in which we are building the e-commerce website with Laravel as the front end and MongoDB as the back end.
In this part, we will show new arrivals and best seller products on the home page dynamically.
For new arrivals, we will show the last 4 products added to our Laravel E-commerce website.
For best sellers, we will show the best seller products marked by the admin in the products module of the admin panel. Later on, best-seller products are based on the maximum number of orders.
First, we will resolve a few issues that we are facing while updating the product details from the admin panel.
Update addEditProduct function :-
We will update the addEditProduct function at ProductController. We will update the category discount-related code and add one condition for editing the attribute.
First we will work on showing new arrival products at home page.
1) Update index function:-
First of all, update the index function to get new products from the products table. We will show the last 4 products added by the admin on the home page.
2) Create brand function:-
We will create a belongsTo relation between the product and brand so we will add a brand function in the Product.php model.
3) Update index function :-
Include brand and images relation with Product model at index function
4) Update index.blade.php file :-
Now add foreach loop to show new products from $newProducts array at index.blade.php file
Now, we will work on showing best-seller products on the home page.
5) Update add_edit_product.blade.php
Add the Best Seller checkbox in Add/Edit product form at add_edit_product.blade.php
6) Update addEditProduct function :-
Update the addEditProduct function to update the products table for best seller product. We will insert "Yes" in case if product is best seller product or "No" in case if product is not best seller.
7) Update index function
Now update the index function at IndexController to get best seller products and return to the index blade file
8) Update index.blade.php file :-
Now we will update the index.blade.php file to show Best Seller products in foreach loop
In the next part, we will display the discounted products on the home page dynamically.
►Click here to subscribe for Laravel & other updates - / stackdevelopers
Popular Stack Developers Series that can help you:-
►Laravel 10 Tutorial Playlist: • Laravel 10 Tutorial: Make Admin Panel...
►Laravel Multi-Vendor E-commerce Website - • Laravel Multi Vendor Tutorial
►React JS Tutorial for Beginners with Laravel - • React JS Tutorial with Laravel for Be...
►Laravel Tutorial for Beginners - • Laravel Tutorial for Beginners | Adva...
►GIT Tutorial for Beginners - • Git Tutorial for Beginners | Create y...
►Laravel API Tutorial - • Laravel API Tutorial | Create API fro...
►Laravel Interview Questions - • Laravel Interview Questions & Answers...
►jQuery Tutorial - • jQuery Tutorial
►Laravel Basic E-commerce Series - • Make Admin Panel / E-commerce Website...
►Laravel Dating Series - • Make Dating / Social Networking Websi...
►Join this channel to get the complete source code of all series:
/ @stackdevelopers
Follow Stack Developers on Social Media to get updates and resolve your queries
►Like Facebook Page to get updates - / stackdevelopers2
►Join Facebook Group to resolve your queries - / stackdevelopers
►Follow on Instagram - / stackdevelopers2
►Follow on GitHub - https://github.com/stackdevelopers
#laravel11 #laravel11tutorial #mongodb
Watch video #56 Laravel 11 Tutorial with MongoDB | Display New Arrival / Best Seller Products at Home Page online without registration, duration hours minute second in high quality. This video was added by user Stack Developers 01 January 1970, don't forget to share it with your friends and acquaintances, it has been viewed on our site 5 once and liked it people.