[英]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. 我正在建立一个社交网站,并且需要一个消息传递系统,因此我正在使用this ,因为它看起来不错。
I have set up Laravel and I am about half way through my project. 我已经建立了Laravel,并且大约完成了我的项目的一半。 I have added in laravel-messenger but as soon as I run it I get the following error: 我已经添加了laravel-messenger,但是一旦运行它,我就会收到以下错误:
Argument 1 passed to Illuminate\\Auth\\Guard::login() must implement interface Illuminate\\Contracts\\Auth\\Authenticatable, null given. 传递给Illuminate \\ Auth \\ Guard :: login()的参数1必须实现Illuminate \\ Contracts \\ Auth \\ Authenticatable接口,给定null。
I have Googled and researched but I haven't found a clear solution, I need help! 我已经过Google搜索和研究,但没有找到明确的解决方案,我需要帮助!
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
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.