UnexpectedValueException用户必须实现CanResetPassword接口

时间:2020-07-01 18:42:01

标签: php laravel authentication

我正在使用laravel 6,但重置密码有问题,我没做总结研究,但没有任何效果。他们中的大多数告诉我添加CanResetPassword,我已经添加了它,但还是一无所获。

这是我的User.php类

use Illuminate\Contracts\Auth\MustVerifyEmail;
use Illuminate\Foundation\Auth\User as Authenticatable;
use Illuminate\Notifications\Notifiable;

class User extends Authenticatable
{
   use Notifiable;

   ....
}

Config:Auth

我刚刚添加了一个新的名为password的提供程序,它使用了雄辩的语言。我认为这可能是不好的做法,但是它不再显示相同的错误。

'providers' => [
        'users' => [
            'driver' => 'eloquent',
            'model' => App\User::class,
        ],

        'users' => [
            'driver' => 'database',
            'table' => 'users',
        ],
        'password' => [
            'driver' => 'eloquent',
            'model' => App\User::class,
        ],
    ],

    'passwords' => [
        'users' => [
            'provider' => 'password',
            'table' => 'password_resets',
            'expire' => 60,
            'throttle' => 60,
        ],
    ],

这就是添加密码提供者之前的样子

'providers' => [
        'users' => [
            'driver' => 'database',
            'table' => 'users',
        ],
        'password' => [
            'driver' => 'eloquent',
            'model' => App\User::class,
        ],
    ],

    'passwords' => [
        'users' => [
            'provider' => 'users',
            'table' => 'password_resets',
            'expire' => 60,
            'throttle' => 60,
        ],
    ],

0 个答案:

没有答案