In Part-63 of the Laravel 9 Tutorial to create a Multi-Vendor E-commerce Website in Laravel, we will start working on the listing page where we will show all products of some particular category.
Like if we open the link of t-shirts category then it will display all t-shirts. And if we open the link of the shirts category then it will display all shirts.
Here one thing we need to note that if we open link of parent category like shirts that is having sub categories like casual shirts and formal shirts then it will show both casual and formal shirts under shirts category. And if we open casual shirts url then it will show only casual shirts.
1) Create ProductsController :-
First of all, we will create ProductsController in Front folder of Controllers.
php artisan make:controller Front/ProductsController
2) Create listing Route :-
To create listing route for all categories, we need to fetch url's for all categories from categories table and make routes for them in foreach loop.
2.1) Include Category Model in web.php file :-
use App\Category;
2.2) Now add query to fetch all categories url and make GET routes for all categories in foreach loop.
3) Create listing function :-
Now create a listing function in ProductsController so that we can get all the products of the particular category. First, we will check if the category exists or not. And if not exists then we will return the user to 404 page. We will also design 404 page soon in future videos.
4) Include below Classes to ProductsController
use Illuminate\Support\Facades\Route;
use App\Models\Category;
5) Create categoryDetails function :-
Now we will create categoryDetails function in Category model to get the category details and category id's. If user opens the parent category url then we will get category id of parent as well as sub categories.
6) Update listing Function :-
Now update listing function in ProductsController to call categoryDetails function to get category details and category id's that will help us to write query to get the products.
To be continued...
►Laravel 9 Tutorial (Create Multi-Vendor E-commerce Website) - • Laravel Multi Vendor Tutorial
►Get Ready for Laravel 9 - • Learning Laravel 9
►Click here to subscribe for Laravel & other updates - / stackdevelopers
Popular Stack Developers Series that can help you:-
►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
#laravel9 #laravel9tutorial #laravel
Смотрите видео Laravel 9 Tutorial #63 | Multi Vendor Ecommerce | Product Listing (I) | Product Listing Overview онлайн без регистрации, длительностью часов минут секунд в хорошем качестве. Это видео добавил пользователь Stack Developers 01 Январь 1970, не забудьте поделиться им ссылкой с друзьями и знакомыми, на нашем сайте его посмотрели 1,577 раз и оно понравилось 29 людям.