From 40ae1e3cddca729958a4c7d9a7801d8d74b7d052 Mon Sep 17 00:00:00 2001 From: Artem Brezhnev Date: Tue, 13 Sep 2022 22:51:04 +0300 Subject: [PATCH] Fix issue #22 --- src/Repositories/TenantRepository.php | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/Repositories/TenantRepository.php b/src/Repositories/TenantRepository.php index cbfeea4..1e0c032 100644 --- a/src/Repositories/TenantRepository.php +++ b/src/Repositories/TenantRepository.php @@ -51,9 +51,13 @@ public function all(bool $withTrashed = true) */ public function findByAnyIdentifier($key, bool $withTrashed = true) { - return $this->query($withTrashed) - ->where('id', $key) - ->orWhere('key', $key) + $query = $this->query($withTrashed); + + if (is_int($key)) { + return $query->where('id', $key)->get(); + } + + return $query->where('key', $key) ->orWhere('uuid', $key) ->get(); }