Skip to content

Start building your next app or website — with AI, right in your browser.

Visit devdojo.com
Docs
Authentication Events

Apps (Coming Soon) 21 / 32

Authentication Events

Learn how to tap into Login, Register, Verify, and PasswordReset events to customize and enhance your user authentication experience.

This package includes several events triggered during the authentication process. These events allow developers to integrate additional functionality when specific authentication-related activities occur. If you are unfamiliar with events, be sure to check out the official Events documentation.

There are four events available: Login, Register, Verify, and PasswordReset.

Available Events

1. Login

This event is fired when a user successfully logs in — from the main login page or from the two-factor authentication page. Whenever a user is successfully logged in, this event will fire.

event(new Login(auth()->guard('web'), $user, true));

2. Register

This event is fired when a new user successfully registers.

event(new Registered($user));

3. Verify

This event is fired when a user verifies their email address.

event(new Verified($user));

4. PasswordReset

This event is fired when a user successfully resets their password.

event(new PasswordReset($user));

Creating Listeners

To create a listener for a specific event you can run the following artisan command:

php artisan make:listener UserLoggedIn --event=Illuminate\\Auth\\Events\\Login

This will create a new file located at app/Listeners/UserLoggedIn.php. You can capture this event inside of the handle method. Here is an example:

<?php

namespace App\Listeners;

use Illuminate\Auth\Events\Login;
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Queue\InteractsWithQueue;

class UserLoggedIn
{
    /**
     * Create the event listener.
     */
    public function __construct()
    {
        //
    }

    /**
     * Handle the event.
     */
    public function handle(Login $event): void
    {
        $user = $event->user;
        // Perform any functionality with the user here...
    }
}

Here, you will be able to perform any type of functionality with the user before they are authenticated. You can do the same with the Register, Verify, or PasswordReset events.

Additional Events and Functionality

If you find yourself unable to add desired functionality to the authentication process, feel free to submit a PR, or discuss it with us, and we'll help you find the best approach.

© 2026 DevDojo Edit this page