Skip to content

Commit 1efc4b6

Browse files
committed
add enum check when fetching values from where statements
Fixes: #426
1 parent 3b03241 commit 1efc4b6

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)