From 227517cc6c7d92851f041cd3ec465af35d8d18ad Mon Sep 17 00:00:00 2001 From: Irvine Chang Date: Mon, 13 Apr 2020 20:24:56 +0800 Subject: [PATCH] - Skip adding currentBinding in the CacheKey class if the where values is not in the query binding. --- src/CacheKey.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/CacheKey.php b/src/CacheKey.php index cef259f..b88d9a0 100644 --- a/src/CacheKey.php +++ b/src/CacheKey.php @@ -234,7 +234,10 @@ protected function getInAndNotInClauses(array $where) : string $type = strtolower($where["type"]); $subquery = $this->getValuesFromWhere($where); $values = collect($this->query->bindings["where"][$this->currentBinding] ?? []); - $this->currentBinding += count($where["values"]); + + if (Str::startsWith($subquery, $values->first())) { + $this->currentBinding += count($where["values"]); + } if (! is_numeric($subquery) && ! is_numeric(str_replace("_", "", $subquery))) { try {