Laravel 10 Tutorial #45 | Create E-commerce | Products Module (II) | Insert Products with Seeder

Опубликовано: 14 Октябрь 2024
на канале: Stack Developers
777
6

►Laravel 10 Tutorial Playlist:    • Laravel 10 Tutorial: Make Admin Panel...  

In Part-45 of the Laravel 10 Tutorial, we will continue working on the Products module. In this video, we will add a few products with Seeder though later on we will add products from the admin panel.

1) Create ProductsController :-
Create ProductsController in Admin folder at /app/Http/Controllers/Admin/ by running below command :-
php artisan make:controller Admin/ProductsController

Now, We will create Seeding for products table to insert one test product from file.

2) Writing Seeder / Create ProductsTableSeeder file :-
First of all, we will generate seeder and create ProductsTableSeeder file from where we will add one product for products table.

Run below artisan command to generate Seeder and create ProductsTableSeeder file :-
php artisan make:seeder ProductsTableSeeder

Above command will create ProductsTableSeeder.php file at \database\seeds\

Now open ProductsTableSeeder file and add record for product.

use App\Models\Product;

3) Update DatabaseSeeder.php file :-
Now update DatabaseSeeder.php file located at database/seeds/ to add ProductsTableSeeder class as shown in video.

4) Run below command :-
Now run below command that will finally insert product into products table.
php artisan db:seed

In the next video, we will work on the View Product page in the admin panel.

►Click here to subscribe for Laravel & other updates -    / stackdevelopers  

Popular Stack Developers Series that can help you:-

►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

#laravel10 #laravel10tutorial #laravel