From 70c956a68f75e5a88ee250179cb0ed06dc07e10a Mon Sep 17 00:00:00 2001 From: Jorrin <43169049+JorrinKievit@users.noreply.github.com> Date: Tue, 24 Sep 2024 10:44:51 +0200 Subject: [PATCH 1/3] retrieve primary key identifier for auth code --- src/Bridge/AuthCodeRepository.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Bridge/AuthCodeRepository.php b/src/Bridge/AuthCodeRepository.php index 2dfb626a9..b78fe5eca 100644 --- a/src/Bridge/AuthCodeRepository.php +++ b/src/Bridge/AuthCodeRepository.php @@ -40,7 +40,7 @@ public function persistNewAuthCode(AuthCodeEntityInterface $authCodeEntity) */ public function revokeAuthCode($codeId) { - Passport::authCode()->where('id', $codeId)->update(['revoked' => true]); + Passport::authCode()->where(Passport::authCode()->getKeyName(), $codeId)->update(['revoked' => true]); } /** @@ -48,6 +48,6 @@ public function revokeAuthCode($codeId) */ public function isAuthCodeRevoked($codeId) { - return Passport::authCode()->where('id', $codeId)->where('revoked', 1)->exists(); + return Passport::authCode()->where(Passport::authCode()->getKeyName(), $codeId)->where('revoked', 1)->exists(); } } From cf591f2f16f7935723dce67fe184fab4ad9516f0 Mon Sep 17 00:00:00 2001 From: Jorrin <43169049+JorrinKievit@users.noreply.github.com> Date: Tue, 24 Sep 2024 12:12:13 +0200 Subject: [PATCH 2/3] retrieve primary key identifier --- src/TokenRepository.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/TokenRepository.php b/src/TokenRepository.php index b68f339b8..2849aaefb 100644 --- a/src/TokenRepository.php +++ b/src/TokenRepository.php @@ -25,7 +25,7 @@ public function create($attributes) */ public function find($id) { - return Passport::token()->where('id', $id)->first(); + return Passport::token()->where(Passport::token()->getKeyName(), $id)->first(); } /** @@ -37,7 +37,7 @@ public function find($id) */ public function findForUser($id, $userId) { - return Passport::token()->where('id', $id)->where('user_id', $userId)->first(); + return Passport::token()->where(Passport::token()->getKeyName(), $id)->where('user_id', $userId)->first(); } /** @@ -86,7 +86,7 @@ public function save(Token $token) */ public function revokeAccessToken($id) { - return Passport::token()->where('id', $id)->update(['revoked' => true]); + return Passport::token()->where(Passport::token()->getKeyName(), $id)->update(['revoked' => true]); } /** From 866f6e7334952b6ea3e742f8557c34e4f34c826c Mon Sep 17 00:00:00 2001 From: Jorrin <43169049+JorrinKievit@users.noreply.github.com> Date: Tue, 24 Sep 2024 14:31:57 +0200 Subject: [PATCH 3/3] use whereKey instead --- src/Bridge/AuthCodeRepository.php | 4 ++-- src/TokenRepository.php | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/Bridge/AuthCodeRepository.php b/src/Bridge/AuthCodeRepository.php index b78fe5eca..3718c3c4c 100644 --- a/src/Bridge/AuthCodeRepository.php +++ b/src/Bridge/AuthCodeRepository.php @@ -40,7 +40,7 @@ public function persistNewAuthCode(AuthCodeEntityInterface $authCodeEntity) */ public function revokeAuthCode($codeId) { - Passport::authCode()->where(Passport::authCode()->getKeyName(), $codeId)->update(['revoked' => true]); + Passport::authCode()->whereKey($codeId)->update(['revoked' => true]); } /** @@ -48,6 +48,6 @@ public function revokeAuthCode($codeId) */ public function isAuthCodeRevoked($codeId) { - return Passport::authCode()->where(Passport::authCode()->getKeyName(), $codeId)->where('revoked', 1)->exists(); + return Passport::authCode()->whereKey($codeId)->where('revoked', 1)->exists(); } } diff --git a/src/TokenRepository.php b/src/TokenRepository.php index 2849aaefb..cdf66a326 100644 --- a/src/TokenRepository.php +++ b/src/TokenRepository.php @@ -25,7 +25,7 @@ public function create($attributes) */ public function find($id) { - return Passport::token()->where(Passport::token()->getKeyName(), $id)->first(); + return Passport::token()->whereKey($id)->first(); } /** @@ -37,7 +37,7 @@ public function find($id) */ public function findForUser($id, $userId) { - return Passport::token()->where(Passport::token()->getKeyName(), $id)->where('user_id', $userId)->first(); + return Passport::token()->whereKey($id)->where('user_id', $userId)->first(); } /** @@ -86,7 +86,7 @@ public function save(Token $token) */ public function revokeAccessToken($id) { - return Passport::token()->where(Passport::token()->getKeyName(), $id)->update(['revoked' => true]); + return Passport::token()->whereKey($id)->update(['revoked' => true]); } /**