Laravel 8 Jetstream Basic Setup with Email Verification

  2908 views   1 year ago Laravel

Laravel Jetstream is a beautifully designed application scaffolding for Laravel. Jetstream includes login, registration, email verification, two-factor authentication, session management, API support via Laravel Sanctum, and optional team management. Laravel Jetstream replaces and improves upon the legacy authentication UI scaffolding available for previous versions of Laravel.

In this tutorial we will show you the steps to setup the basic Jetstream setup with email verification after registering.

Step - 1 : Create new laravel application

First we need to create laravel 8 application in our local system help of run the following command in terminal.

composer create-project --prefer-dist laravel/laravel blog

Step - 2 : install jetstream package using composer

composer require laravel/jetstream

Step - 3 : install dependencies

After installing Jetstream, you should install and build your NPM dependencies

npm install

Step - 4 : Run Databse migrations

php artisan migrate

Step - 5 : Check autogenerated files in your project directory

After installing jetstream you will have autogenerated files in resources/views directory.

Step - 6 : Enable email verification

uncomment the relevant entry in the features configuration item of the config/fortify.php configuration file

'features' => [

Step - 7 : Email setup

Next you need to setup your email settings through which reistration mail willbe sent. You can setup this in your .env file. Below is gmail account setup example. To send email through gmail account you need to enable the two factor email verification and generate application name nd can check the steps for two factor email verification.

[email protected]
[email protected]

Step - 8 : Implement MustVerifyEmail interface

Edit app\Models\User.php as below


namespace App\Models;

use Illuminate\Contracts\Auth\MustVerifyEmail;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Foundation\Auth\User as Authenticatable;
use Illuminate\Notifications\Notifiable;
use Laravel\Fortify\TwoFactorAuthenticatable;
use Laravel\Jetstream\HasProfilePhoto;
use Laravel\Sanctum\HasApiTokens;

class User extends Authenticatable implements MustVerifyEmail
    use HasApiTokens;
    use HasFactory;
    use HasProfilePhoto;
    use Notifiable;
    use TwoFactorAuthenticatable;

     * The attributes that are mass assignable.
     * @var array
    protected $fillable = [

     * The attributes that should be hidden for arrays.
     * @var array
    protected $hidden = [

     * The attributes that should be cast to native types.
     * @var array
    protected $casts = [
        'email_verified_at' => 'datetime',

     * The accessors to append to the model's array form.
     * @var array
    protected $appends = [

Now run the application to see the output.You will see the login, register link.

After register one email will be sent to your registered email account. and by clicking on the verification link you can verify your account and then can login.

After login on top right corner there will be dropdown to manage profile, manage account, team, etc.

Author : Harsukh Makwana
Harsukh Makwana

Hi, My name is Harsukh Makwana. i have been work with many programming language like php, python, javascript, node, react, anguler, etc.. since last 5 year. if you have any issue or want me hire then contact me on [email protected]