Argument 1 passed to Illuminate\Auth\SessionGuard::login() must be an instance of Illuminate\Contracts\Auth\Authenticatable, instance of App\User given,
使用laravel内置的注册认证系统,注册账号,提示如下错误。Google之后,发现github的一个答案,解决了。分享一下
Argument 1 passed to Illuminate\Auth\SessionGuard::login() must be an instance of Illuminate\Contracts\Auth\Authenticatable, instance of App\User given,
如下,修改一下你的User模型即可
use Illuminate\Contracts\Auth\Authenticatable;
use Illuminate\Database\Eloquent\Model; use Illuminate\Auth\Authenticatable as AuthenticableTrait; class User extends Model implements Authenticatable { use AuthenticableTrait;
其实5.5以上有更简洁的办法,用于登录认证的模型类需要继承 Illuminate\Foundation\Auth\User
基类,不然后面就会出现不能认证的窘况。