Laravel menjalankan fungsi setelah lupa kata sandi

*Create Listener in 'App\Listeners'

<?php

namespace App\Listeners;
use App\PasswordHistory;
use Illuminate\Auth\Events\PasswordReset;

class ResetPasswordListener
{
    public function handle(PasswordReset $passwordReset)
    {
        $passwordHistory = PasswordHistory::create([
            'user_id' => $passwordReset->user->id,
            'password' => $passwordReset->user->password
        ]);
    }
}

*Add this to $listen in 'App\Providers\EventServiceProvider.php'
  
  'Illuminate\Auth\Events\PasswordReset' => [
    'App\Listeners\ResetPasswordListener'
  ]
Lazurite