Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

Jeyziii's avatar

laravel jetstream login

I am new in using laravel jetstream, where can I edit the login controller of it? I want to add a check if the user is soft deleted or not. I cannot find it. There is no authentication in the action folder. TIA.

0 likes
1 reply
LaryAI's avatar
Level 58

In Laravel Jetstream, the authentication logic is handled by Fortify. You can customize the Fortify authentication logic by creating a new Fortify service provider and registering it in your config/app.php file.

Here's an example of how you can add a check for soft deleted users in the Fortify authentication logic:

  1. Create a new Fortify service provider by running the following command:
php artisan make:provider CustomFortifyServiceProvider
  1. In the boot method of your new service provider, add the following code:
use Illuminate\Http\Request;
use Laravel\Fortify\Fortify;

public function boot()
{
    Fortify::authenticateUsing(function (Request $request) {
        $user = User::where('email', $request->email)->first();

        if ($user && $user->trashed()) {
            throw ValidationException::withMessages([
                Fortify::username() => __('Your account has been deactivated.'),
            ]);
        }

        if ($user && Hash::check($request->password, $user->password)) {
            return $user;
        }
    });
}

This code checks if the user exists and is soft deleted. If the user is soft deleted, it throws a validation exception with a custom message. If the user exists and the password is correct, it returns the user.

  1. Register your new service provider in the providers array in your config/app.php file:
'providers' => [
    // ...
    App\Providers\CustomFortifyServiceProvider::class,
],

After completing these steps, your Fortify authentication logic will include a check for soft deleted users.

Please or to participate in this conversation.