filmov
tv
Laravel 10 Tutorial #45 | Create E-commerce | Products Module (II) | Insert Products with Seeder
Показать описание
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
Now open ProductsTableSeeder file and add record for product.
use App\Models\Product;
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.
Popular Stack Developers Series that can help you:-
►Join this channel to get the complete source code of all series:
Follow Stack Developers on Social Media to get updates and resolve your queries
#laravel10 #laravel10tutorial #laravel
Комментарии