►Laravel 9 Tutorial from the beginning:- • Laravel Multi Vendor Tutorial
In Part-185 of the Multi Vendor E-commerce series, we will start working on the Newsletter Subscriber feature in which users can subscribe to the website newsletter by entering their emails.
In this video, we will create a newsletter_subscribers table with Migration and will add a few entries with Seeder commands.
We will also create a model for the newsletter_subscribers table.
1) Create newsletter_subscribers table:-
First of all, we will create a newsletter_subscribers table with migration. Create migration file with name create_newsletter_subscribers_table for creating newsletter_subscribers table with below columns:-
id, email, status, created_at, updated_at
So, we will run the below artisan command to create a migration file for newsletter_subscribers:-
php artisan make:migration create_newsletter_subscribers_table
Open the create_newsletter_subscribers_table migration file and add all required columns mentioned earlier.
Now, we will run below artisan command to create a newsletter_subscribers table with required columns:-
php artisan migrate
2) Create NewsletterSubscriber model:-
Create a NewsletterSubscriber model by running the below command:-
php artisan make:model NewsletterSubscriber
Now, We will create a Seeding for newsletter_subscribers table to insert dummy subscribers.
3) Writing Seeder / Create NewsletterSubscriberTableSeeder file :-
Now, we will generate Seeder and create a NewsletterSubscriberTableSeeder file where we will add records for the newsletter_subscribers table.
Run below artisan command to generate Seeder and create NewsletterSubscriberTableSeeder file:-
php artisan make:seeder NewsletterSubscriberTableSeeder
The above command will create NewsletterSubscriberTableSeeder.php file at \database\seeds\
Now open the NewsletterSubscriberTableSeeder file and add a query for adding dummy subscribers.
4) Update DatabaseSeeder.php file:-
Now update DatabaseSeeder.php file located at database/seeds/ to add NewsletterSubscriberTableSeeder class as shown in video.
5) Run below commands:-
Now run the below commands that will finally insert records into the newsletter_subscribers table.
composer dump-autoload
php artisan db:seed
In the next video, we will work on newsletter subscriber functionality. We will create a newsletter subscriber field and will insert the subscriber email in the newsletter_subscribers table if not already exists.
►Laravel 9 Tutorial Playlist (Create Multi-Vendor E-commerce Website) - • Laravel Multi Vendor Tutorial
►Click here to subscribe for Laravel & other updates - / stackdevelopers
Popular Stack Developers Series that can help you:-
►React JS Tutorial for Beginners with Laravel 9 - • 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
#laravel9 #laravel9tutorial #laravel