File tree 2 files changed +5
-0
lines changed
2 files changed +5
-0
lines changed Original file line number Diff line number Diff line change @@ -30,6 +30,7 @@ protected static function decodeVirtualColumn(self $model): void
30
30
31
31
foreach ($ model ->getAttribute (static ::getDataColumn ()) ?? [] as $ key => $ value ) {
32
32
$ model ->setAttribute ($ key , $ value );
33
+ $ model ->syncOriginalAttribute ($ key );
33
34
}
34
35
35
36
$ model ->setAttribute (static ::getDataColumn (), null );
@@ -52,6 +53,7 @@ protected static function encodeAttributes(self $model): void
52
53
]));
53
54
54
55
unset($ model ->attributes [$ key ]);
56
+ unset($ model ->original [$ key ]);
55
57
}
56
58
}
57
59
Original file line number Diff line number Diff line change @@ -34,6 +34,7 @@ public function keys_which_dont_have_their_own_column_go_into_data_json_column()
34
34
// Model has the correct structure when retrieved
35
35
$ model = MyModel::first ();
36
36
$ this ->assertSame ('bar ' , $ model ->foo );
37
+ $ this ->assertSame ('bar ' , $ model ->getOriginal ('foo ' ));
37
38
$ this ->assertSame (null , $ model ->data );
38
39
39
40
// Model can be updated
@@ -43,7 +44,9 @@ public function keys_which_dont_have_their_own_column_go_into_data_json_column()
43
44
]);
44
45
45
46
$ this ->assertSame ('baz ' , $ model ->foo );
47
+ $ this ->assertSame ('baz ' , $ model ->getOriginal ('foo ' ));
46
48
$ this ->assertSame ('xyz ' , $ model ->abc );
49
+ $ this ->assertSame ('xyz ' , $ model ->getOriginal ('abc ' ));
47
50
$ this ->assertSame (null , $ model ->data );
48
51
49
52
// Model can be retrieved after update & is structure correctly
You can’t perform that action at this time.
0 commit comments