Skip to content

Commit 8ee9a68

Browse files
committed
move cast
1 parent 97de613 commit 8ee9a68

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/Eloquent/Model.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -209,15 +209,15 @@ protected function getAttributeFromArray($key)
209209
/** @inheritdoc */
210210
public function setAttribute($key, $value)
211211
{
212+
$key = (string) $key;
213+
212214
// Convert _id to ObjectID.
213215
if ($key === '_id' && is_string($value)) {
214216
$builder = $this->newBaseQueryBuilder();
215217

216218
$value = $builder->convertKey($value);
217219
}
218220

219-
$key = (string) $key;
220-
221221
// Support keys in dot notation.
222222
if (str_contains($key, '.')) {
223223
// Store to a temporary key, then move data to the actual key

0 commit comments

Comments
 (0)