Skip to content

Commit 48db425

Browse files
authored
Merge pull request #427 from alexhampu/master
add enum check when fetching values from where statements, fixes #426
2 parents 3b03241 + 1efc4b6 commit 48db425

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

Diff for: src/CacheKey.php

+9-1
Original file line numberDiff line numberDiff line change
@@ -287,7 +287,15 @@ protected function getValuesFromWhere(array $where) : string
287287
return implode("_", collect($where["value"])->flatten()->toArray());
288288
}
289289

290-
return (new Arr)->get($where, "value", "");
290+
$value = (new Arr)->get($where, "value", "");
291+
292+
if ($value instanceof \BackedEnum) {
293+
return $value->value;
294+
} elseif ($value instanceof \UnitEnum) {
295+
return $value->name;
296+
}
297+
298+
return $value;
291299
}
292300

293301
protected function getValuesFromBindings(array $where, string $values) : string

0 commit comments

Comments
 (0)