File tree Expand file tree Collapse file tree 1 file changed +22
-16
lines changed Expand file tree Collapse file tree 1 file changed +22
-16
lines changed Original file line number Diff line number Diff line change @@ -55,25 +55,31 @@ public static function load(
55
55
$ constrain = [];
56
56
57
57
foreach ($ resources as $ resource ) {
58
+ if (!$ resource instanceof EloquentResource) {
59
+ continue ;
60
+ }
61
+
58
62
$ modelClass = get_class ($ resource ->newModel ($ context ));
59
63
60
- if ($ resource instanceof EloquentResource && !isset ($ constrain [$ modelClass ])) {
61
- $ constrain [$ modelClass ] = function ($ query ) use (
62
- $ resource ,
63
- $ context ,
64
- $ relationship ,
65
- ) {
66
- $ resource ->scope ($ query , $ context );
67
-
68
- if (
69
- ($ relationship instanceof ToMany ||
70
- $ relationship instanceof ToOne) &&
71
- $ relationship ->scope
72
- ) {
73
- ($ relationship ->scope )($ query , $ context );
74
- }
75
- };
64
+ if (isset ($ constrain [$ modelClass ])) {
65
+ continue ;
76
66
}
67
+
68
+ $ constrain [$ modelClass ] = function ($ query ) use (
69
+ $ resource ,
70
+ $ context ,
71
+ $ relationship ,
72
+ ) {
73
+ $ resource ->scope ($ query , $ context );
74
+
75
+ if (
76
+ ($ relationship instanceof ToMany ||
77
+ $ relationship instanceof ToOne) &&
78
+ $ relationship ->scope
79
+ ) {
80
+ ($ relationship ->scope )($ query , $ context );
81
+ }
82
+ };
77
83
}
78
84
79
85
if ($ relation instanceof MorphTo) {
You can’t perform that action at this time.
0 commit comments