diff --git a/src/Eloquent/CustomRelations/RelationCleverTrait.php b/src/Eloquent/CustomRelations/RelationCleverTrait.php index e52d636..d814fab 100644 --- a/src/Eloquent/CustomRelations/RelationCleverTrait.php +++ b/src/Eloquent/CustomRelations/RelationCleverTrait.php @@ -6,7 +6,7 @@ trait RelationCleverTrait { - protected static ?string $noConstraintsForRelationName = null; + public static ?string $noConstraintsForRelationName = null; /** * Indicates if the relation is adding constraints. @@ -19,10 +19,10 @@ trait RelationCleverTrait public static function noConstraints(\Closure $callback, ?string $relationName = null): mixed { $previous = static::$constraints; - $previousNoConstraintsForRelationName = static::$noConstraintsForRelationName; + $previousNoConstraintsForRelationName = RelationCleverTrait::$noConstraintsForRelationName; if ('' !== (string)$relationName) { - static::$noConstraintsForRelationName = $relationName; + RelationCleverTrait::$noConstraintsForRelationName = $relationName; } else { static::$constraints = false; } @@ -31,14 +31,14 @@ public static function noConstraints(\Closure $callback, ?string $relationName = return $callback(); } finally { static::$constraints = $previous; - static::$noConstraintsForRelationName = $previousNoConstraintsForRelationName; + RelationCleverTrait::$noConstraintsForRelationName = $previousNoConstraintsForRelationName; } } protected function setConstraintsStaticFlag(BaseModel $model): void { if ( - '' === (string)static::$noConstraintsForRelationName + '' === (string)RelationCleverTrait::$noConstraintsForRelationName || '' === (string)$model->nowEagerLoadingRelationNameWithNoConstraints ) { return; @@ -66,6 +66,6 @@ protected function setConstraintsStaticFlag(BaseModel $model): void with nowEagerLoadingRelationNameWithNoConstraints = null and with $noConstraintsForRelationName = 'rel' */ static::$constraints = - static::$noConstraintsForRelationName !== $model->nowEagerLoadingRelationNameWithNoConstraints; + RelationCleverTrait::$noConstraintsForRelationName !== $model->nowEagerLoadingRelationNameWithNoConstraints; } } \ No newline at end of file