Laravel-BadMethodCallException调用未定义的方法App \ User :: getAuthIdentifierName()

时间:2019-10-31 22:52:17

标签: laravel authentication

我知道这个问题已经问过很多遍了,但是给出的答案都没有帮助。在某种程度上,因为大多数答案都说要做已经做的事情。每个页面都会显示错误:“ BadMethodCallException调用未定义的方法App \ User :: getAuthIdentifierName()”。

这是发生了什么。身份验证工作正常。然后,我进行了新的迁移:

php artisan migrate:fresh --seed

在那之后,错误出现了。

这是我的应用/用户模型代码:

<?php

namespace App;

use Illuminate\Notifications\Notifiable;
use Illuminate\Foundation\Auth\User as Authenticatable;
use Illuminate\Contracts\Auth\MustVerifyEmail;
use jeremykenedy\LaravelRoles\Traits\HasRoleAndPermission;
use Illuminate\Database\Eloquent\SoftDeletes;

class User extends Authenticatable implements MustVerifyEmail
// class User extends Authenticatable
{
    use SoftDeletes;
    use Notifiable;
    use HasRoleAndPermission;

    protected $dates = ['deleted_at'];

    /**
     * The attributes that are mass assignable.
     *
     * @var array
     */
    protected $fillable = [
        'name', 'email', 'password',
    ];

    /**
     * The attributes that should be hidden for arrays.
     *
     * @var array
     */
    protected $hidden = [
        'password', 'remember_token',
    ];

    /**
     * The attributes that should be cast to native types.
     *
     * @var array
     */
    protected $casts = [
        'email_verified_at' => 'datetime',
    ];
}

我尝试运行php artisan ui vue --auth并对所有覆盖的问题都回答“是”,但这没用。

对于可能导致此问题的其他任何帮助,将不胜感激。

编辑:仅供参考,我更改为重新迁移的唯一内容是几个种子文件。

0 个答案:

没有答案