From 5daf960b8321b05ecb0924b692f511aa67ad4679 Mon Sep 17 00:00:00 2001 From: Timothy Date: Tue, 14 Jul 2020 23:09:19 +0200 Subject: [PATCH] Use the Tenant models' getTenantKeyName() value 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 03df9767..80d4d0bb 100644 --- a/src/Tenancy.php +++ b/src/Tenancy.php @@ -80,7 +80,7 @@ class Tenancy public function find($id): ?Tenant { - return $this->model()->find($id); + return $this->model()->where($this->model()->getTenantKeyName(), $id)->first(); } /**