How to clear login attempts of user in Laravel 7 based on their email?

Viewed 166

Good day,

I am using Laravel AuthenticatesUsers trait, using php artisan cache:clear clears the login attempts however I am trying to implement an artisan command that will clear the login attempts of a specific users based on their emails, here is the handle() of my artisan command:

    public function handle()
    {
        $user = User::where('email', $this->argument('user_email'))->first();
        $request = new Request($user->getAttributes());
        echo 'Login attempts cleared.';
    }

I am able to call the artisan command I created however it seems that the user attempts is still not cleared.

1 Answers

I got it, for anyone else having the same problem this is what I did override the function throttleKey in the LoginController and CustomPACommand

public function throttleKey(Request $request)
{
    return Str::lower($request->input($this->username()));
}
Related