Laravel – Argument 1 passed to IlluminateAuthEloquentUserProvider::validateCredentials()

I use multi auth in laravel 5.6.

I use linux 16.4. and PHP 7.2

After run http://localhost:8000/manage/login and click login button, show this error:

"Type error: Argument 1 passed to IlluminateAuthEloquentUserProvider::validateCredentials() must be an instance of IlluminateContractsAuthAuthenticatable, instance of AppAdmin given, called in /media/project/vendor/laravel/framework/src/Illuminate/Auth/SessionGuard.php on line 380"

How to issue this problem?

Answers:

Thank you for visiting the Q&A section on Magenaut. Please note that all the answers may not help you solve the issue immediately. So please treat them as advisements. If you found the post helpful (or not), leave a comment & I’ll get back to you as soon as possible.

Method 1

It just means that your Admin model hasn’t implemented the Authenticatable interface.

Include the following use statement in your class and then implement it e.g.

use IlluminateContractsAuthAuthenticatable as AuthenticatableContract;

class Admin extends Model implements AuthenticatableContract {
    ...
}

You will then need to make sure that all of the necessary methods are included in your model. The easiest way to do this would be to include the Authenticatable trait e.g.
use IlluminateAuthAuthenticatable;
use IlluminateContractsAuthAuthenticatable as AuthenticatableContract;

class Admin extends Model implements AuthenticatableContract {

    use Authenticatable;
}

Lastly, you may need to override some of the methods depending on if you’re db table is different from the out-of-the-box User.


All methods was sourced from stackoverflow.com or stackexchange.com, is licensed under cc by-sa 2.5, cc by-sa 3.0 and cc by-sa 4.0

0 0 votes
Article Rating
Subscribe
Notify of
guest

0 Comments
Inline Feedbacks
View all comments
0
Would love your thoughts, please comment.x
()
x