Laravel 5.3 Password Broker Customization

前端 未结 2 2116
生来不讨喜
生来不讨喜 2020-12-14 03:30

Does anyone know how to override the functions used within laravel\'s password broker? I know the docs:

https://laravel.com/docs/5.3/passwords#resetting-views

<
2条回答
  •  悲&欢浪女
    2020-12-14 04:25

    There are some missing things for step 1 & 3 in the answer https://stackoverflow.com/a/42855948/2311074

    Step 1

    Probably the safest way is to simply copy the class from Illuminate\Auth\Passwords\PassswordResetServiceProvider.php to App\Provider\CustomPasswordResetServiceProviderand change:

    1. Namespace to namespace App\Providers;
    2. Class name to CustomPasswordResetServiceProvider
    3. Add use App\Services\CustomPasswordBrokerManager; to the top
    4. Inside the function registerPasswordBroker rename PasswordBrokerManager to CustomPasswordBrokerManager

    Step 2.

    Besides changing the resolve method also do the following:

    1. Change namespace to namespace App\Services;
    2. Add use Illuminate\Auth\Passwords\DatabaseTokenRepository; to the top
    3. Change class name to CustomPasswordBrokerManager

提交回复
热议问题