Skip to content

Commit

Permalink
[12.x] Add refreshToken relation to Token model (#1739)
Browse files Browse the repository at this point in the history
* Add refreshToken relation

* Update Token.php

---------

Co-authored-by: Taylor Otwell <taylor@laravel.com>
  • Loading branch information
gdebrauwer and taylorotwell authored Apr 17, 2024
1 parent 66eaa66 commit b24c646
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions src/Token.php
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,16 @@ public function client()
return $this->belongsTo(Passport::clientModel());
}

/**
* Get the refresh token associated with the token.
*
* @return \Illuminate\Database\Eloquent\Relations\HasOne
*/
public function refreshToken()
{
return $this->hasOne(Passport::refreshTokenModel(), 'access_token_id');
}

/**
* Get the user that the token belongs to.
*
Expand Down

0 comments on commit b24c646

Please sign in to comment.