简体   繁体   中英

Laravel messenger - Argument 1 passed to Illuminate\Auth\Guard::login() must implement interface Illuminate\Contracts\Auth\Authenticatable, null given

I am building a social networking site, and need a messaging system so I am using this , as it looks pretty good.

I have set up Laravel and I am about half way through my project. I have added in laravel-messenger but as soon as I run it I get the following error:

Argument 1 passed to Illuminate\\Auth\\Guard::login() must implement interface Illuminate\\Contracts\\Auth\\Authenticatable, null given.

I have Googled and researched but I haven't found a clear solution, I need help!

Your User model should be like this (should implement these and use proper traits)

use Illuminate\Auth\Authenticatable;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Auth\Passwords\CanResetPassword;
use Illuminate\Foundation\Auth\Access\Authorizable;
use Illuminate\Contracts\Auth\Authenticatable as AuthenticatableContract;
use Illuminate\Contracts\Auth\Access\Authorizable as AuthorizableContract;
use Illuminate\Contracts\Auth\CanResetPassword as CanResetPasswordContract;

class User extends Model implements AuthenticatableContract,
                                AuthorizableContract,
                                CanResetPasswordContract
{
    use Authenticatable, Authorizable, CanResetPassword;
    //enter code here
}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM