File tree 1 file changed +5
-6
lines changed
1 file changed +5
-6
lines changed Original file line number Diff line number Diff line change 46
46
use function str_contains ;
47
47
use function str_starts_with ;
48
48
use function strcmp ;
49
- use function uniqid ;
50
49
use function var_export ;
51
50
52
51
/** @mixin Builder */
@@ -55,6 +54,8 @@ abstract class Model extends BaseModel
55
54
use HybridRelations;
56
55
use EmbedsRelations;
57
56
57
+ private const TEMPORARY_KEY = '__LARAVEL_TEMPORARY_KEY__ ' ;
58
+
58
59
/**
59
60
* The collection associated with the model.
60
61
*
@@ -271,12 +272,10 @@ public function setAttribute($key, $value)
271
272
// Support keys in dot notation.
272
273
if (str_contains ($ key , '. ' )) {
273
274
// Store to a temporary key, then move data to the actual key
274
- $ uniqueKey = uniqid ($ key );
275
-
276
- parent ::setAttribute ($ uniqueKey , $ value );
275
+ parent ::setAttribute (self ::TEMPORARY_KEY , $ value );
277
276
278
- Arr::set ($ this ->attributes , $ key , $ this ->attributes [$ uniqueKey ] ?? null );
279
- unset($ this ->attributes [$ uniqueKey] );
277
+ Arr::set ($ this ->attributes , $ key , $ this ->attributes [self :: TEMPORARY_KEY ] ?? null );
278
+ unset($ this ->attributes [self :: TEMPORARY_KEY ], $ uniqueKey );
280
279
281
280
return $ this ;
282
281
}
You can’t perform that action at this time.
0 commit comments