File tree Expand file tree Collapse file tree 1 file changed +22
-17
lines changed Expand file tree Collapse file tree 1 file changed +22
-17
lines changed Original file line number Diff line number Diff line change @@ -55,26 +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
- $ relation ,
66
- ) {
67
- $ resource ->scope ($ query , $ context );
68
-
69
- if (
70
- ($ relationship instanceof ToMany ||
71
- $ relationship instanceof ToOne) &&
72
- $ relationship ->scope
73
- ) {
74
- ($ relationship ->scope )($ relation , $ context );
75
- }
76
- };
64
+ if (isset ($ constrain [$ modelClass ])) {
65
+ continue ;
77
66
}
67
+
68
+ $ constrain [$ modelClass ] = function ($ query ) use (
69
+ $ resource ,
70
+ $ context ,
71
+ $ relationship ,
72
+ $ relation ,) {
73
+ $ resource ->scope ($ query , $ context );
74
+
75
+ if (
76
+ ($ relationship instanceof ToMany ||
77
+ $ relationship instanceof ToOne) &&
78
+ $ relationship ->scope
79
+ ) {
80
+ ($ relationship ->scope )($ relation , $ context );
81
+ }
82
+ };
78
83
}
79
84
80
85
if ($ relation instanceof MorphTo) {
You can’t perform that action at this time.
0 commit comments