Laravel Jetstream Login with Username or Email Example




Hello Friends,

Today, I would like to share with you laravel jetstream login with username or email example. We will show login with username/email in laravel jetstream. In this article, i will learn you example of laravel jetstream login with username. we will integrate a laravel jetstream login with username or email.

Here, i will give simple and easy way to implement laravel jetstream login with username or email. you can easily integrate with laravel 6, laravel 7 and laravel 8 version.

after installing laravel jetstream successfully. you need to do following changes on that files:



namespace App\Providers;

use App\Actions\Fortify\CreateNewUser;

use App\Actions\Fortify\ResetUserPassword;

use App\Actions\Fortify\UpdateUserPassword;

use App\Actions\Fortify\UpdateUserProfileInformation;

use Illuminate\Support\ServiceProvider;

use Laravel\Fortify\Fortify;

use Laravel\Fortify\Http\Requests\LoginRequest;

use App\Models\User;

use Hash;

class FortifyServiceProvider extends ServiceProvider



* Register any application services.


* @return void


public function register()




* Bootstrap any application services.


* @return void


public function boot()






Fortify::authenticateUsing(function (LoginRequest $request) {

$user = User::where('email', $request->identity)

->orWhere('username', $request->identity)->first();

if (

$user &&

Hash::check($request->password, $user->password)

) {

return $user;






'username' => 'email',


'username' => 'identity',




<x-slot name="logo">

<x-jet-authentication-card-logo />


<x-jet-validation-errors class="mb-4" />

@if (session('status'))

<div class="mb-4 font-medium text-sm text-green-600">

{{ session('status') }}



<form method="POST" action="{{ route('login') }}">



<x-jet-label value="{{ __('Username/Email') }}" />

<x-jet-input class="block mt-1 w-full" type="text" name="identity" :value="old('email')" required autofocus />


<div class="mt-4">

<x-jet-label value="{{ __('Password') }}" />

<x-jet-input class="block mt-1 w-full" type="password" name="password" required autocomplete="current-password" />


<div class="block mt-4">

<label class="flex items-center">

<input type="checkbox" class="form-checkbox" name="remember">

<span class="ml-2 text-sm text-gray-600">{{ __('Remember me') }}</span>



<div class="flex items-center justify-end mt-4">

@if (Route::has('password.request'))

<a class="underline text-sm text-gray-600 hover:text-gray-900" href="{{ route('password.request') }}">

{{ __('Forgot your password?') }}



<x-jet-button class="ml-4">

{{ __('Login') }}






Now, you can run and check it.

It will help you....

#Laravel 8

#Laravel 7


#Laravel 6