Reputation:
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 Illuminate\Auth\EloquentUserProvider::validateCredentials() must be an instance of Illuminate\Contracts\Auth\Authenticatable, instance of App\Admin given, called in /media/project/vendor/laravel/framework/src/Illuminate/Auth/SessionGuard.php on line 380"
How to issue this problem?
Upvotes: 0
Views: 9976
Reputation: 35170
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 Illuminate\Contracts\Auth\Authenticatable 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 Illuminate\Auth\Authenticatable;
use Illuminate\Contracts\Auth\Authenticatable 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
.
Upvotes: 4