@@ -66,7 +66,7 @@ public function toModel(bool $fillExcludedAttributes = false): Model
66
66
if ($ fillExcludedAttributes ) {
67
67
/** @var Model $model */
68
68
$ model = ($ this ->relationLoaded ('subject ' )
69
- ? $ this ->getRelation ('subject ' ) : $ this ->subject ()->firstOrFail ()
69
+ ? $ this ->getRelation ('subject ' ) : $ this ->subject ()->firstOrFail ()
70
70
)->replicate ();
71
71
} else {
72
72
/** @var Model $model */
@@ -87,7 +87,7 @@ public function revert(): Model
87
87
$ model ->save ();
88
88
89
89
$ this ->newQuery ()
90
- ->whereMorphedTo ($ this ->subject (), $ model ->getMorphClass ())
90
+ ->where ($ this ->subject ()-> getMorphType (), $ model ->getMorphClass ())
91
91
->where (self ::CREATED_AT , '> ' , $ this ->getAttribute (self ::CREATED_AT ))
92
92
->each (function (self $ snapshot ) {
93
93
$ snapshot ->delete ();
@@ -106,13 +106,13 @@ public function branch(): Model
106
106
/** @var Model $model */
107
107
$ model = DB ::transaction (function () {
108
108
$ model = ($ this ->relationLoaded ('subject ' )
109
- ? $ this ->getRelation ('subject ' ) : $ this ->subject ()->firstOrFail ()
109
+ ? $ this ->getRelation ('subject ' ) : $ this ->subject ()->firstOrFail ()
110
110
)->replicate ();
111
111
$ model ->setRawAttributes ($ this ->getAttribute ('stored_attributes ' ));
112
112
$ model ->save ();
113
113
114
114
$ this ->newQuery ()
115
- ->whereMorphedTo ($ this ->subject (), $ model ->getMorphClass ())
115
+ ->where ($ this ->subject ()-> getMorphType (), $ model ->getMorphClass ())
116
116
->where (self ::CREATED_AT , '<= ' , $ this ->getAttribute (self ::CREATED_AT ))
117
117
->each (function (self $ snapshot ) use ($ model ) {
118
118
$ replicate = $ snapshot ->replicate ();
@@ -131,7 +131,7 @@ public function branch(): Model
131
131
public function fork (): Model
132
132
{
133
133
$ model = ($ this ->relationLoaded ('subject ' )
134
- ? $ this ->getRelation ('subject ' ) : $ this ->subject ()->firstOrFail ()
134
+ ? $ this ->getRelation ('subject ' ) : $ this ->subject ()->firstOrFail ()
135
135
)->replicate ();
136
136
$ model ->setRawAttributes ($ this ->getAttribute ('stored_attributes ' ));
137
137
$ model ->save ();
0 commit comments