Skip to content

Commit

Permalink
refactor: decouple UUID column guessing and UUID value preparation fo…
Browse files Browse the repository at this point in the history
…r reuse in additional scopes
  • Loading branch information
mostafaznv committed Oct 21, 2024
1 parent 17702a2 commit a0e81f8
Showing 1 changed file with 2 additions and 9 deletions.
11 changes: 2 additions & 9 deletions src/GeneratesUuid.php
Original file line number Diff line number Diff line change
Expand Up @@ -122,15 +122,8 @@ public function resolveUuidVersion(): string
*/
public function scopeWhereUuid($query, $uuid, $uuidColumn = null): Builder
{
$uuidColumn = ! is_null($uuidColumn) && in_array($uuidColumn, $this->uuidColumns())
? $uuidColumn
: $this->uuidColumns()[0];

$uuid = $this->normaliseUuids($uuid);

if ($this->isClassCastable($uuidColumn)) {
$uuid = $this->bytesFromUuid($uuid);
}
$uuidColumn = $this->guessUuidColumn($uuidColumn);
$uuid = $this->prepareUuid($uuid, $uuidColumn);

return $query->whereIn(
$this->qualifyColumn($uuidColumn),
Expand Down

0 comments on commit a0e81f8

Please sign in to comment.