Skip to content

Commit a40ff70

Browse files
authored
Correction in eloquent-mutators.md Comparing Cast Values (#10497)
1 parent 5070d92 commit a40ff70

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

eloquent-mutators.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -932,7 +932,7 @@ protected function casts(): array
932932

933933
If you would like to define how two given cast values should be compared to determine if they have been changed, your custom cast class may implement the `Illuminate\Contracts\Database\Eloquent\ComparesCastableAttributes` interface. This allows you to have fine-grained control over which values Eloquent considers changed and thus saves to the database when a model is updated.
934934

935-
This interface states that your class should contain a `compare` method which should return `true` if the given values are different:
935+
This interface states that your class should contain a `compare` method which should return `true` if the given values are considered equal:
936936

937937
```php
938938
/**
@@ -950,7 +950,7 @@ public function compare(
950950
mixed $firstValue,
951951
mixed $secondValue
952952
): bool {
953-
return $firstValue !== $secondValue;
953+
return $firstValue === $secondValue;
954954
}
955955
```
956956

0 commit comments

Comments
 (0)