6
6
7
7
trait RelationCleverTrait
8
8
{
9
- protected static ?string $ noConstraintsForRelationName = null ;
9
+ public static ?string $ noConstraintsForRelationName = null ;
10
10
11
11
/**
12
12
* Indicates if the relation is adding constraints.
@@ -19,10 +19,10 @@ trait RelationCleverTrait
19
19
public static function noConstraints (\Closure $ callback , ?string $ relationName = null ): mixed
20
20
{
21
21
$ previous = static ::$ constraints ;
22
- $ previousNoConstraintsForRelationName = static ::$ noConstraintsForRelationName ;
22
+ $ previousNoConstraintsForRelationName = RelationCleverTrait ::$ noConstraintsForRelationName ;
23
23
24
24
if ('' !== (string )$ relationName ) {
25
- static ::$ noConstraintsForRelationName = $ relationName ;
25
+ RelationCleverTrait ::$ noConstraintsForRelationName = $ relationName ;
26
26
} else {
27
27
static ::$ constraints = false ;
28
28
}
@@ -31,14 +31,14 @@ public static function noConstraints(\Closure $callback, ?string $relationName =
31
31
return $ callback ();
32
32
} finally {
33
33
static ::$ constraints = $ previous ;
34
- static ::$ noConstraintsForRelationName = $ previousNoConstraintsForRelationName ;
34
+ RelationCleverTrait ::$ noConstraintsForRelationName = $ previousNoConstraintsForRelationName ;
35
35
}
36
36
}
37
37
38
38
protected function setConstraintsStaticFlag (BaseModel $ model ): void
39
39
{
40
40
if (
41
- '' === (string )static ::$ noConstraintsForRelationName
41
+ '' === (string )RelationCleverTrait ::$ noConstraintsForRelationName
42
42
|| '' === (string )$ model ->nowEagerLoadingRelationNameWithNoConstraints
43
43
) {
44
44
return ;
@@ -66,6 +66,6 @@ protected function setConstraintsStaticFlag(BaseModel $model): void
66
66
with nowEagerLoadingRelationNameWithNoConstraints = null
67
67
and with $noConstraintsForRelationName = 'rel' */
68
68
static ::$ constraints =
69
- static ::$ noConstraintsForRelationName !== $ model ->nowEagerLoadingRelationNameWithNoConstraints ;
69
+ RelationCleverTrait ::$ noConstraintsForRelationName !== $ model ->nowEagerLoadingRelationNameWithNoConstraints ;
70
70
}
71
71
}
0 commit comments