diff --git a/src/CachedBuilder.php b/src/CachedBuilder.php index 7166e50..fd073f8 100644 --- a/src/CachedBuilder.php +++ b/src/CachedBuilder.php @@ -35,6 +35,7 @@ protected function getCacheKey(array $columns = ['*'], $idColumn = null) : strin protected function getIdColumn(string $idColumn) : string { + return $idColumn ? "_{$idColumn}" : ''; } @@ -72,13 +73,20 @@ protected function getQueryColumns(array $columns) : string protected function getWhereClauses() : string { + // dump($this->query->wheres); return collect($this->query->wheres)->reduce(function ($carry, $where) { - $value = $where['value'] ?? implode('_', ($where['values'] ?? [])); - - if (! $value) { + if (! $where['column'] ?? false) { return $carry . ''; } + $value = $where['value'] ?? ''; + + if ($where['values'] ?? false) { + $value .= 'in_' . implode('_', $where['values']); + } + + $value = $where['type'] === 'Null' ? 'null' : $value; + return "{$carry}-{$where['column']}_{$value}"; }) ?: ''; }