From 853fdb19fa07c46dd9f8f5f7d17cc0bd234ad099 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Samuel=20=C5=A0tancl?= Date: Mon, 28 Oct 2019 15:01:14 +0100 Subject: [PATCH] Only put to storage when persisted --- src/Tenant.php | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/Tenant.php b/src/Tenant.php index 30a4981a..696104ea 100644 --- a/src/Tenant.php +++ b/src/Tenant.php @@ -333,12 +333,18 @@ class Tenant implements ArrayAccess } if (is_array($key)) { - $this->storage->putMany($key); + if ($this->persisted) { + $this->storage->putMany($key); + } + foreach ($key as $k => $v) { // Add to cache $this->data[$k] = $v; } } else { - $this->storage->put($key, $value); + if ($this->persisted) { + $this->storage->put($key, $value); + } + $this->data[$key] = $value; }