Skip to content

Commit b05d0f3

Browse files
committed
Add user relationship to client model.
1 parent 76ef21a commit b05d0f3

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

src/Client.php

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,18 @@ public function tokens()
6161
return $this->hasMany(Passport::tokenModel(), 'client_id');
6262
}
6363

64+
/**
65+
* Get the user that the client belongs to.
66+
*
67+
* @return \Illuminate\Database\Eloquent\Relations\BelongsTo
68+
*/
69+
public function user()
70+
{
71+
$provider = config('auth.guards.api.provider');
72+
73+
return $this->belongsTo(config('auth.providers.'.$provider.'.model'));
74+
}
75+
6476
/**
6577
* Determine if the client is a "first party" client.
6678
*

0 commit comments

Comments
 (0)