File tree Expand file tree Collapse file tree 1 file changed +31
-0
lines changed Expand file tree Collapse file tree 1 file changed +31
-0
lines changed Original file line number Diff line number Diff line change @@ -251,6 +251,37 @@ public function attributesToArray()
251
251
return $ attributes ;
252
252
}
253
253
254
+ /** @inheritdoc */
255
+ protected function setAttributeMarkedMutatedAttributeValue ($ key , $ value )
256
+ {
257
+ $ attribute = $ this ->{Str::camel ($ key )}();
258
+
259
+ $ callback = $ attribute ->set ?: function ($ value ) use ($ key ) {
260
+ $ this ->attributes [$ key ] = $ value ;
261
+ };
262
+
263
+ $ normalizeCastClassResponse = $ this ->normalizeCastClassResponse (
264
+ $ key , $ callback ($ value , $ this ->attributes )
265
+ );
266
+
267
+ if (count ($ normalizeCastClassResponse ) > 1 ) {
268
+ $ normalizeCastClassResponse = [$ key => $ normalizeCastClassResponse ];
269
+ }
270
+
271
+ $ this ->attributes = array_merge (
272
+ $ this ->attributes ,
273
+ $ normalizeCastClassResponse
274
+ );
275
+
276
+ if ($ attribute ->withCaching || (is_object ($ value ) && $ attribute ->withObjectCaching )) {
277
+ $ this ->attributeCastCache [$ key ] = $ value ;
278
+ } else {
279
+ unset($ this ->attributeCastCache [$ key ]);
280
+ }
281
+
282
+ return $ this ;
283
+ }
284
+
254
285
/** @inheritdoc */
255
286
public function getCasts ()
256
287
{
You can’t perform that action at this time.
0 commit comments