Skip to content
This repository was archived by the owner on Apr 19, 2025. It is now read-only.

Commit a6f10e7

Browse files
committed
Fixed use of foreign and local/owner key.
See #3 (comment). See #3 (comment).
1 parent d44c99f commit a6f10e7

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

src/TwoFactorAuth.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,6 @@ class TwoFactorAuth extends Model
3939
*/
4040
public function user() : BelongsTo
4141
{
42-
return $this->belongsTo(\App\User::class, config('twofactor-auth.models.user.primaryKey', 'id'));
42+
return $this->belongsTo(\App\User::class, 'user_id', config('twofactor-auth.models.user.primaryKey', 'id'));
4343
}
4444
}

src/TwoFactorAuthenticable.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ trait TwoFactorAuthenticable
1515
*/
1616
public function twoFactorAuth() : HasOne
1717
{
18-
return $this->hasOne(TwoFactorAuth::class, $this->getKeyName());
18+
return $this->hasOne(TwoFactorAuth::class, 'user_id', $this->getKeyName());
1919
}
2020

2121
/**

0 commit comments

Comments
 (0)