How to extend or make a custom PasswordBroker sendResetLink() method in Laravel 10?

Posted by

Error:

ERROR: Declaration of App\Services\CustomPasswordBroker::sendResetLink(array $credentials, ?Closure $callback = null) must be compatible with Illuminate\Auth\Passwords\PasswordBroker::sendResetLink(array $credentials, $callback = null) {"exception":"[object] (Symfony\\Component\\ErrorHandler\\Error\\FatalError(code: 0): Declaration of App\\Services\\CustomPasswordBroker::sendResetLink(array $credentials, ?Closure $callback = null) must be compatible with Illuminate\\Auth\\Passwords\\PasswordBroker::sendResetLink(array $credentials, $callback = null) at /opt/lampp/htdocs/myhospitalnow/mhn-core-ms/app/Services/CustomPasswordBroker.php:22)
<?php

Solution:

Go to mhn-core-ms\app\Services\CustomPasswordBroker.php

And change this line all

The base class Illuminate\Auth\Passwords\PasswordBroker contains the sendResetLink function with the following signature:

public function sendResetLink(array $credentials, $callback = null)

And change all the place request to callback

All code here

After that run this command

php artisan config:clear
php artisan route:clear
php artisan view:clear
composer dump-autoload
Subscribe
Notify of
guest
0 Comments
Inline Feedbacks
View all comments
0
Would love your thoughts, please comment.x
()
x