Laravel overriding EloquentUserProvider to change password field name in validateCredentials()

放肆的年华 提交于 2019-12-05 15:28:20

How did you 'override' the instance of EloquentUserProvider ? Because Laravel is creating the Auth instance based on what auth.driver you have set.

Check Illuminate/Auth/CreatesUserProviders@createUserProvider it is hardcoded, based on driver, to load EloquentUserProvider. What you can try is bind your instance to the Illuminate\Auth\EloquentUserProvider.

The error you get, means that your __construct isn't getting the proper input. Based on how your code looks like, its basicly doing this:

new AuthUserProvider($app);

But what it should do:

return new EloquentUserProvider($this->app['hash'], $config['model']);

If it is not working try registering a custom provider through the AuthManager class. See Illuminate\Auth\AuthManager@provider line +- 266.

Maybe!! not tested:

auth()->provider(AuthUserProvider::class);
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!