Skip to content

Commit 515cc10

Browse files
author
Afonso Gloeden
authored
Nonstandard ID in the token's relationship with the user (#1267)
1 parent 343e3ea commit 515cc10

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/Token.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,9 @@ public function user()
7979
{
8080
$provider = config('auth.guards.api.provider');
8181

82-
return $this->belongsTo(config('auth.providers.'.$provider.'.model'));
82+
$model = config('auth.providers.'.$provider.'.model');
83+
84+
return $this->belongsTo($model, 'user_id', (new $model)->getKeyName());
8385
}
8486

8587
/**

0 commit comments

Comments
 (0)