Skip to content

Commit

Permalink
Refactored to use enum_value() in castBinding() (#53131)
Browse files Browse the repository at this point in the history
  • Loading branch information
toarupg0318 authored Oct 12, 2024
1 parent 3818c2a commit e738a72
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/Illuminate/Database/Query/Builder.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@
use RuntimeException;
use UnitEnum;

use function Illuminate\Support\enum_value;

class Builder implements BuilderContract
{
/** @use \Illuminate\Database\Concerns\BuildsQueries<object> */
Expand Down Expand Up @@ -4208,7 +4210,7 @@ public function addBinding($value, $type = 'where')
public function castBinding($value)
{
if ($value instanceof UnitEnum) {
return $value instanceof BackedEnum ? $value->value : $value->name;
return enum_value($value);
}

return $value;
Expand Down

0 comments on commit e738a72

Please sign in to comment.