Here is my connection method to send the reset password to the protector , which is part of the multi-auth system.
I am going to assume that you have correctly installed the new guard in config/auth.php which might look like this:
I use the word admin for the new guard name for a better understanding.
'guards' => [ 'admin' => [ 'driver' => 'session', 'provider' => 'admins', ], ] 'providers' => [ 'admins' => [ 'driver' => 'eloquent', 'model' => App\Admin::class, ], ] 'passwords' => [ 'admins' => [ 'provider' => 'admins', 'table' => 'password_resets', 'expire' => 15, ], ]
You will need to create new controllers ( AdminForgotPasswordController and AdminResetPasswordController ) for the new defender
Both of them use the Password facade, and the AdminResetPasswordController also uses the Auth facade.
Change the build function to suit your new defender.
So add this for both controllers because we have a specific type of guest user.
public function __construct() { $this->middleware('guest:admin'); }
Now we need to say AdminResetPasswordController in order to use proper authentication protection.
So add this method to the controller
protected function guard() { return Auth::guard('admin'); }
Now add this piece of code to both controllers.
protected function broker() { return Password::broker('admins');
Note: This is not the only step to implement a reset password for protection, you will have to take other steps, such as creating new routes, notifications, forms and corresponding views.