Skip to content

Commit

Permalink
Add user relationship to client model.
Browse files Browse the repository at this point in the history
  • Loading branch information
mattkoch614 committed Oct 19, 2018
1 parent 76ef21a commit b05d0f3
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions src/Client.php
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,18 @@ public function tokens()
return $this->hasMany(Passport::tokenModel(), 'client_id');
}

/**
* Get the user that the client belongs to.
*
* @return \Illuminate\Database\Eloquent\Relations\BelongsTo
*/
public function user()
{
$provider = config('auth.guards.api.provider');

return $this->belongsTo(config('auth.providers.'.$provider.'.model'));
}

/**
* Determine if the client is a "first party" client.
*
Expand Down

0 comments on commit b05d0f3

Please sign in to comment.