In Part-209 of the Laravel E-commerce series, we will start working on Return Order functionality like Amazon.
In this video, we will create a return_requests table with Migration and will add a few entries with Seeder commands.
We will also create a model for the return_requests table.
1) Create return_requests table:-
First of all, we will create a return_requests table with migration. Create migration file with name create_return_requests_table for creating return_requests table with below columns :-
id, order_id, user_id, product_id, product_code, return_reason, return_status, created_at, updated_at
So, we will run the below artisan command to create a migration file for return_requests:-
php artisan make:migration create_return_requests_table
Open the create_return_requests_table migration file and add all required columns mentioned earlier.
Now, we will run below artisan command to create a return_requests table with required columns:-
php artisan migrate
2) Create ReturnRequest model:-
Create a ReturnRequest model by running the below command:-
php artisan make:model ReturnRequest
Now, We will create a Seeding for return_requests table to insert dummy return requests.
3) Writing Seeder / Create ReturnRequestTableSeeder file :-
Now, we will generate Seeder and create a ReturnRequestTableSeeder file where we will add records for the return_requests table.
Run below artisan command to generate Seeder and create ReturnRequestTableSeeder file :-
php artisan make:seeder ReturnRequestTableSeeder
The above command will create ReturnRequestTableSeeder.php file at \database\seeds\
Now open the ReturnRequestTableSeeder file and add a query for adding dummy return requests.
4) Update DatabaseSeeder.php file:-
Now update DatabaseSeeder.php file located at database/seeds/ to add ReturnRequestTableSeeder class as shown in video.
5) Run below commands:-
Now run the below commands that will finally insert records into the return_requests table.
composer dump-autoload (if required)
php artisan db:seed
In the next video, we will update the user order detail page to show the return link.
Thanks for watching :)
Join this channel to get complete code/support :
https://www.youtube.com/channel/UCExO2i-tLU1NyVZD6zOJQlw/join
In this video, we will create a return_requests table with Migration and will add a few entries with Seeder commands.
We will also create a model for the return_requests table.
1) Create return_requests table:-
First of all, we will create a return_requests table with migration. Create migration file with name create_return_requests_table for creating return_requests table with below columns :-
id, order_id, user_id, product_id, product_code, return_reason, return_status, created_at, updated_at
So, we will run the below artisan command to create a migration file for return_requests:-
php artisan make:migration create_return_requests_table
Open the create_return_requests_table migration file and add all required columns mentioned earlier.
Now, we will run below artisan command to create a return_requests table with required columns:-
php artisan migrate
2) Create ReturnRequest model:-
Create a ReturnRequest model by running the below command:-
php artisan make:model ReturnRequest
Now, We will create a Seeding for return_requests table to insert dummy return requests.
3) Writing Seeder / Create ReturnRequestTableSeeder file :-
Now, we will generate Seeder and create a ReturnRequestTableSeeder file where we will add records for the return_requests table.
Run below artisan command to generate Seeder and create ReturnRequestTableSeeder file :-
php artisan make:seeder ReturnRequestTableSeeder
The above command will create ReturnRequestTableSeeder.php file at \database\seeds\
Now open the ReturnRequestTableSeeder file and add a query for adding dummy return requests.
4) Update DatabaseSeeder.php file:-
Now update DatabaseSeeder.php file located at database/seeds/ to add ReturnRequestTableSeeder class as shown in video.
5) Run below commands:-
Now run the below commands that will finally insert records into the return_requests table.
composer dump-autoload (if required)
php artisan db:seed
In the next video, we will update the user order detail page to show the return link.
Thanks for watching :)
Join this channel to get complete code/support :
https://www.youtube.com/channel/UCExO2i-tLU1NyVZD6zOJQlw/join
- Catégories
- E commerce Amazon
Commentaires