簡體   English   中英

Laravel Messenger-傳遞給Illuminate \\ Auth \\ Guard :: login()的參數1必須實現Illuminate \\ Contracts \\ Auth \\ Authenticatable接口,給定null

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

我正在建立一個社交網站,並且需要一個消息傳遞系統,因此我正在使用this ,因為它看起來不錯。

我已經建立了Laravel,並且大約完成了我的項目的一半。 我已經添加了laravel-messenger,但是一旦運行它,我就會收到以下錯誤:

傳遞給Illuminate \\ Auth \\ Guard :: login()的參數1必須實現Illuminate \\ Contracts \\ Auth \\ Authenticatable接口,給定null。

我已經過Google搜索和研究,但沒有找到明確的解決方案,我需要幫助!

您的用戶模型應該是這樣的(應該實現這些並使用適當的特征)

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.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM