Change USER Model Primary key ID to another in Laravel Passport

后端 未结 2 1598
爱一瞬间的悲伤
爱一瞬间的悲伤 2021-01-26 07:42

I have a project where I have changed the User model primary key from \"id\" to \"MemberX\" using the following command in my User.php model file:

protected $primaryKey

2条回答
  •  臣服心动
    2021-01-26 07:56

    Add this code to your User model

    {
       return $this->hasMany(Passport::clientModel(), 'user_id', 'MemberID');
    }
    

提交回复
热议问题