首页 > 解决方案 > Laravel 8“我们找不到具有该电子邮件地址的用户。” 尝试重置密码时出错

问题描述

我昨天遇到了这个问题,我试图解决这个问题,但没有运气。我很困惑,这个函数来自 Laravel 默认,我没有更改代码,但即使电子邮件存在于数据库中,它也给了我这个错误。除此重置功能外,所有功能都很好。 在此处输入图像描述 我在数据库中也有一个用户表。 在此处输入图像描述

我已经通过检查核心 Laravel 代码(passwords.php、senpasswordresetsemail.php 等)完成了所有工作,但没有结果,这是我的用户迁移和我的用户模型代码。

用户迁移代码

public function up() {
    Schema::create('users', function (Blueprint $table) {
        $table->increments('user_id');
        $table->string('name');
        $table->string('email')->unique();
        $table->string('password');
        $table->rememberToken();
        $table->string('user_role')->nullable();
        $table->integer('company_number')->nullable();
        $table->string('project_id')->nullable();
        $table->string('group_name')->nullable();
        $table->timestamps();
    });
}

用户型号代码

class User extends Authenticatable implements LdapAuthenticatable {
    use HasFactory, Notifiable, PowerJoins, AuthenticatesWithLdap;

    /**
     * The attributes that are mass assignable.
     *
     * @var array
     */

    protected $primaryKey = 'user_id';

    protected $fillable = [
        'name',
        'email',
        'password',
        'user_role',
        'company_number',
        'project_id',
        'group_name',
    ];

    /**
     * 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',
    ];

    public function companies() {
        return $this->hasOne(Company::class, 'company_number', 'company_number');
    }
}

任何形式的帮助将不胜感激,谢谢!:D

标签: phplaravel

解决方案


推荐阅读