Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[12.x] Add refreshToken relation to Token model #1739

Merged

Conversation

gdebrauwer
Copy link
Contributor

In my project, when I user logs out, I need to revoke the access token and the refresh token linked to that access token. Currently I have to this in the following way:

auth()->user()->token()->revoke();
RefreshToken::where('access_token_id', auth()->user()->token()->id)->first()->revoke();

This PR makes that a bit easier by adding a 'refreshToken' relation to the access token model:

auth()->user()->token()->revoke();
auth()->user()->token()->refreshToken->revoke();

@taylorotwell taylorotwell merged commit b24c646 into laravel:12.x Apr 17, 2024
10 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants