Skip to content

Commit d7075c6

Browse files
authored
Fix where clause parsing
1 parent 013939d commit d7075c6

File tree

1 file changed

+11
-3
lines changed

1 file changed

+11
-3
lines changed

Diff for: src/CachedBuilder.php

+11-3
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ protected function getCacheKey(array $columns = ['*'], $idColumn = null) : strin
3535

3636
protected function getIdColumn(string $idColumn) : string
3737
{
38+
3839
return $idColumn ? "_{$idColumn}" : '';
3940
}
4041

@@ -72,13 +73,20 @@ protected function getQueryColumns(array $columns) : string
7273

7374
protected function getWhereClauses() : string
7475
{
76+
// dump($this->query->wheres);
7577
return collect($this->query->wheres)->reduce(function ($carry, $where) {
76-
$value = $where['value'] ?? implode('_', ($where['values'] ?? []));
77-
78-
if (! $value) {
78+
if (! $where['column'] ?? false) {
7979
return $carry . '';
8080
}
8181

82+
$value = $where['value'] ?? '';
83+
84+
if ($where['values'] ?? false) {
85+
$value .= 'in_' . implode('_', $where['values']);
86+
}
87+
88+
$value = $where['type'] === 'Null' ? 'null' : $value;
89+
8290
return "{$carry}-{$where['column']}_{$value}";
8391
}) ?: '';
8492
}

0 commit comments

Comments
 (0)