Skip to content

Commit e738a72

Browse files
authored
Refactored to use enum_value() in castBinding() (#53131)
1 parent 3818c2a commit e738a72

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/Illuminate/Database/Query/Builder.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,8 @@
2929
use RuntimeException;
3030
use UnitEnum;
3131

32+
use function Illuminate\Support\enum_value;
33+
3234
class Builder implements BuilderContract
3335
{
3436
/** @use \Illuminate\Database\Concerns\BuildsQueries<object> */
@@ -4208,7 +4210,7 @@ public function addBinding($value, $type = 'where')
42084210
public function castBinding($value)
42094211
{
42104212
if ($value instanceof UnitEnum) {
4211-
return $value instanceof BackedEnum ? $value->value : $value->name;
4213+
return enum_value($value);
42124214
}
42134215

42144216
return $value;

0 commit comments

Comments
 (0)