From a0e81f85d8af6ba74d662502fef086b2e4cdb1f8 Mon Sep 17 00:00:00 2001 From: mostafaznv Date: Mon, 21 Oct 2024 17:15:49 +0330 Subject: [PATCH] refactor: decouple UUID column guessing and UUID value preparation for reuse in additional scopes --- src/GeneratesUuid.php | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) diff --git a/src/GeneratesUuid.php b/src/GeneratesUuid.php index e1726ff..530fb9d 100644 --- a/src/GeneratesUuid.php +++ b/src/GeneratesUuid.php @@ -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),