protected function modifyRelationQueryForContext(Model $model, $query)
    {
        /** @var Relation $relation */
        $information = $this->getInformationRepository()->getByModel($model);

        if ( ! $information) {
            return $query;
        }

        // Deal with global scopes, if any
        $disableScopes = $information->meta->disable_global_scopes;

        if (true === $disableScopes || is_array($disableScopes)) {
            $query->withoutGlobalScopes(
                true === $disableScopes ? null : $disableScopes
            );
        }

        // Apply repository context, if any
        $strategy = $information->meta->repository_strategy;

        if ($strategy) {
            $strategy = $this->resolveContextStrategy($strategy);

            if ($strategy) {
                $query = $strategy->apply($query, $information);
            }
        }

        return $query;
    }
protected function modifyRelationQueryForContext(Model $model, $query)
    {
        /** @var Relation $relation */
        $information = $this->getInformationRepository()->getByModel($model);

        if ( ! $information) {
            return $query;
        }

        // Deal with global scopes, if any
        $disableScopes = $information->meta->disable_global_scopes;

        if (true === $disableScopes || is_array($disableScopes)) {
            $query->withoutGlobalScopes(
                true === $disableScopes ? null : $disableScopes
            );
        }

        // Apply repository context, if any
        $strategy = $information->meta->repository_strategy;

        if ($strategy) {
            $strategy = $this->resolveContextStrategy($strategy);

            if ($strategy) {
                $query = $strategy->apply($query, $information);
            }
        }

        return $query;
    }
protected function modifyRelationQueryForContext ( Model $ model , $ query ) { /** @var Relation $relation */ $ information = $ this -> getInformationRepository ( ) -> getByModel ( $ model ) ; if ( ! $ information ) { return $ query ; } // Deal with global scopes, if any $ disableScopes = $ information -> meta -> disable_global_scopes ; if ( true === $ disableScopes || is_array ( $ disableScopes ) ) { $ query -> withoutGlobalScopes ( true === $ disableScopes ? null : $ disableScopes ) ; } // Apply repository context, if any $ strategy = $ information -> meta -> repository_strategy ; if ( $ strategy ) { $ strategy = $ this -> resolveContextStrategy ( $ strategy ) ; if ( $ strategy ) { $ query = $ strategy -> apply ( $ query , $ information ) ; } } return $ query ; }
Modifies the relation query according to the model's CMS information.

@param Model            $model
@param Builder|Relation $query
@return Builder
Modifies the relation query according to the model s CMS information .