Skip to content

Commit 7dda60a

Browse files
authored
Merge pull request #115 from kenjis/add-order-by
fix: add `order by` in UserIdentityModel
2 parents 3564171 + f46d1fc commit 7dda60a

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

src/Models/UserIdentityModel.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,7 @@ public function getAllAccessTokens($userId): array
7272
return $this
7373
->where('user_id', $userId)
7474
->where('type', 'access_token')
75+
->orderBy($this->primaryKey)
7576
->asObject(AccessToken::class)
7677
->findAll();
7778
}
@@ -94,7 +95,7 @@ public function getIdentityBySecret(string $type, ?string $secret): ?UserIdentit
9495
*/
9596
public function getIdentities($userId): array
9697
{
97-
return $this->where('user_id', $userId)->findAll();
98+
return $this->where('user_id', $userId)->orderBy($this->primaryKey)->findAll();
9899
}
99100

100101
/**
@@ -104,7 +105,7 @@ public function getIdentities($userId): array
104105
*/
105106
public function getIdentitiesByUserIds(array $userIds): array
106107
{
107-
return $this->whereIn('user_id', $userIds)->findAll();
108+
return $this->whereIn('user_id', $userIds)->orderBy($this->primaryKey)->findAll();
108109
}
109110

110111
/**

0 commit comments

Comments
 (0)