File tree Expand file tree Collapse file tree 1 file changed +15
-0
lines changed
tests/Integration/Database Expand file tree Collapse file tree 1 file changed +15
-0
lines changed Original file line number Diff line number Diff line change @@ -95,6 +95,21 @@ public function testMorphLoadingMixedWithTrashedRelations()
95
95
$ this ->assertTrue ($ action [1 ]->relationLoaded ('target ' ));
96
96
$ this ->assertInstanceOf (User::class, $ action [1 ]->getRelation ('target ' ));
97
97
}
98
+
99
+ public function testMorphWithTrashedRelationLazyLoading ()
100
+ {
101
+ $ deletedUser = User::forceCreate (['deleted_at ' => now ()]);
102
+
103
+ $ action = new Action ;
104
+ $ action ->target ()->associate ($ deletedUser )->save ();
105
+
106
+ // model is already set via associate and not retrieved from the database
107
+ $ this ->assertInstanceOf (User::class, $ action ->target );
108
+
109
+ $ action ->unsetRelation ('target ' );
110
+
111
+ $ this ->assertInstanceOf (User::class, $ action ->target );
112
+ }
98
113
}
99
114
100
115
class Action extends Model
You can’t perform that action at this time.
0 commit comments