From 683bb5a88d5a77924f30510608078ee85c5d4b89 Mon Sep 17 00:00:00 2001 From: Timothy Date: Wed, 15 Jul 2020 00:01:28 +0200 Subject: [PATCH] Use the Tenant models' getTenantKeyName() value (#461) Don't assume the Tenant can be found with the `id` attribute. The Tenant model allows for setting a different Tenant key name through `getTenantKeyName()`, so lets use it to find the Tenant. --- src/Tenancy.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Tenancy.php b/src/Tenancy.php index 03df9767f..80d4d0bb3 100644 --- a/src/Tenancy.php +++ b/src/Tenancy.php @@ -80,7 +80,7 @@ public function model() public function find($id): ?Tenant { - return $this->model()->find($id); + return $this->model()->where($this->model()->getTenantKeyName(), $id)->first(); } /**