MYHOSPITALNOW.COM

Find Trusted Doctors & Hospitals

Discover healthcare providers, compare hospitals, and explore treatment options worldwide.

Free Treatment Quotes • Doctor Search • Hospital Comparison

Find Healthcare Options

www.myhospitalnow.com

How to Verify an Email in Laravel?

How to Verify an Email in Laravel?

Step 1. Create a new Project in Laravel, so Open git Bash. Write down the following command:-

$ composer create-project --prefer-dist laravel/laravel Emailverify "5.8.*"Code language: JavaScript (javascript)
Git Bash running composer create-project --prefer-dist laravel/laravel Emailverify 5.8.*

Step 2. Now, Move to project directory on git Bash, so write down the following command:-

$ cd emailverify
Git Bash running cd emailverify to move into the new Laravel project directory

Step 3. So, we have to Create a new Database. Go to XAMPP server->phpMyAdmin->Click New Database-> emailverify.

PhpMyAdmin Databases tab with emailverify typed in the Create database field

Mysql Database connection Laravel

Step 4.  Now, Go to .env file to set the project path and give the project APP_URL, DB_DATABASE name and DB_USERNAME name.

Laravel .env file in Sublime Text with APP_URL set to localhost/emailverify/public and MySQL DB settings
Laravel .env file in Sublime Text with APP_URL, DB_DATABASE=emailverify and DB_USERNAME=root set

Step 5. Create the user authentication scaffolding. Write down the following command:-

$ php artisan make:auth
Git Bash terminal running php artisan make:auth in the Emailverify project

Step 6. Go to app\Providers\AppServicesProvider.php and write down the following code:-

 public function register()
    {
        Schema::defaultStringLength(200);
    }Code language: CSS (css)
use Illuminate\Support\Facades\Schema;Code language: PHP (php)
AppServiceProvider.php importing Schema facade and setting Schema::defaultStringLength(200) in register

Step 7. Thereafter, Migrate tables into the MySQL database. Write the following command within git Base.

$ php artisan migrate
Git Bash terminal running php artisan migrate in the Emailverify project

Step 8. Implement the MustVerifyEmail feature in User Model.

User.php model where class User extends Authenticatable implements MustVerifyEmail

Step 9. Go to routes/web.php file and write down the following code:-

Routes/web.php with Auth::routes(['verify' => true]) highlighted
Route::get('/home', 'HomeController@index')->name('home')->middleware('verified');Code language: PHP (php)
Routes/web.php with the home route protected by middleware('verified')

Step 11. Open this link https://mailtrap.io/ and login with your Google account.

Step 12. Click the demo inbox link.

Mailtrap My Inboxes page with the Demo inbox link highlighted

Step 12. Copy port, username , password and paste in .env file.

Mailtrap Demo inbox SMTP Settings showing host, port, username and password credentials
Laravel .env file with MAIL_HOST smtp.mailtrap.io, port, username and password filled in

Step 13. Firstly, You have to register, then log in your project.

Laravel login form with email address and password entered

Step 14. Now, you can see that it’s asking for email verification.

Laravel Verify Your Email Address notice asking the user to check for a verification link

Step 15. After clicking, a fresh verification link would have sent to your email address. You can see the mailtrap.in the demo inbox.

Mailtrap Demo inbox showing the Laravel Verify Email Address message and button

Step 16. Click the Verify Email Address button . After that you’ll be logged in your dashboard.

Laravel dashboard showing You are logged in! after email verification

Thanks

Find Trusted Cardiac Hospitals

Compare heart hospitals by city and services — all in one place.

Explore Hospitals
With MotoShare.in, you can book a bike instantly, enjoy doorstep delivery, and ride without worries. Perfect for travelers, professionals, and adventure enthusiasts looking for a seamless mobility solution.

Related Posts

Comprehensive Guide to Solving 429 Too Many Requests in Laravel and Microservices

🚫 What is HTTP 429 – Too Many Requests? HTTP 429 means the client has sent too many requests in a given amount of time (rate limiting)….

Read More

Top 100 laravel interview questions and answers

1) What is Laravel? Laravel is an open-source widely used PHP framework. The platform was intended for the development of web application by using MVC architectural pattern….

Read More

How to Login with Token in Laravel PHP Framework?

How to Login with Token in Laravel PHP Framework? Step 1. Create a new Project, so write down the following command on Git Bash: Step 2. Move…

Read More

How to Create Multiple role-based users in Laravel Application

Open command prompt or Git Bash on xampp/htdocs directory 2. Create Laravel New Project write this command composer create-project –prefer-dist laravel/laravel Gurukulgalaxy “5.8.*” Move to project directory…

Read More

How to display a table in a Verticle or Horizontal form in the Laravel PHP Framework? Part-1

How to display a table in a Verticle or Horizontal form in the Laravel PHP Framework? How to Store Seed file into Database. Click There are two…

Read More

Simple Ajax CRUD Application in Laravel

Step 1 – Create a fresh laravel projet First off all , create a project using following command given below – Change Directory to AjaxCrud folder Step…

Read More