File tree Expand file tree Collapse file tree 1 file changed +7
-4
lines changed
src/Eloquent/CustomRelations/Builders Expand file tree Collapse file tree 1 file changed +7
-4
lines changed Original file line number Diff line number Diff line change @@ -134,14 +134,17 @@ protected function getRelationWithoutConstraints($relation): Relation
134
134
*/
135
135
protected function getBelongsToRelation (MorphTo $ relation , $ type ): BelongsTo
136
136
{
137
- /** this will work as before */
138
137
$ belongsTo = Relation::macroNoConstraints (function () use ($ relation , $ type ): Relation {
139
- return $ this ->model ->belongsTo (
138
+ $ model = $ this ->getModel ();
139
+ $ model ->nowEagerLoadingRelationNameWithNoConstraints = $ relation ->getRelationName ();
140
+
141
+ return $ model ->belongsTo (
140
142
$ type ,
141
143
$ relation ->getForeignKeyName (),
142
- $ relation ->getOwnerKeyName ()
144
+ $ relation ->getOwnerKeyName (),
145
+ $ relation ->getRelationName (),
143
146
);
144
- });
147
+ }, $ relation -> getRelationName () );
145
148
146
149
$ belongsTo ->getQuery ()->mergeConstraintsFrom ($ relation ->getQuery ());
147
150
You can’t perform that action at this time.
0 commit comments