Skip to content

Commit

Permalink
move cast
Browse files Browse the repository at this point in the history
  • Loading branch information
GromNaN committed Oct 18, 2023
1 parent 97de613 commit 8ee9a68
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/Eloquent/Model.php
Original file line number Diff line number Diff line change
Expand Up @@ -209,15 +209,15 @@ protected function getAttributeFromArray($key)
/** @inheritdoc */
public function setAttribute($key, $value)
{
$key = (string) $key;

// Convert _id to ObjectID.
if ($key === '_id' && is_string($value)) {
$builder = $this->newBaseQueryBuilder();

$value = $builder->convertKey($value);
}

$key = (string) $key;

// Support keys in dot notation.
if (str_contains($key, '.')) {
// Store to a temporary key, then move data to the actual key
Expand Down

0 comments on commit 8ee9a68

Please sign in to comment.