src/Rebing/GraphQL/Support/SelectFields.php
protected static function validateField($fieldObject)
    {
        $selectable = true;

        // If not a selectable field
        if(isset($fieldObject->config['selectable']) && $fieldObject->config['selectable'] === false)
        {
            $selectable = false;
        }

        if(isset($fieldObject->config['privacy']))
        {
            $privacyClass = $fieldObject->config['privacy'];

            // If privacy given as a closure
            if(is_callable($privacyClass) && call_user_func($privacyClass, self::$args) === false)
            {
                $selectable = null;
            }
            // If Privacy class given
            elseif(is_string($privacyClass))
            {
                if(array_has(self::$privacyValidations, $privacyClass))
                {
                    $validated = self::$privacyValidations[$privacyClass];
                }
                else
                {
                    $validated = call_user_func([app($privacyClass), 'fire'], self::$args);
                    self::$privacyValidations[$privacyClass] = $validated;
                }

                if( ! $validated)
                {
                    $selectable = null;
                }
            }
        }

        return $selectable;
    }
protected static function validateField($fieldObject)
    {
        $selectable = true;

        // If not a selectable field
        if(isset($fieldObject->config['selectable']) && $fieldObject->config['selectable'] === false)
        {
            $selectable = false;
        }

        if(isset($fieldObject->config['privacy']))
        {
            $privacyClass = $fieldObject->config['privacy'];

            // If privacy given as a closure
            if(is_callable($privacyClass) && call_user_func($privacyClass, self::$args) === false)
            {
                $selectable = null;
            }
            // If Privacy class given
            elseif(is_string($privacyClass))
            {
                if(array_has(self::$privacyValidations, $privacyClass))
                {
                    $validated = self::$privacyValidations[$privacyClass];
                }
                else
                {
                    $validated = call_user_func([app($privacyClass), 'fire'], self::$args);
                    self::$privacyValidations[$privacyClass] = $validated;
                }

                if( ! $validated)
                {
                    $selectable = null;
                }
            }
        }

        return $selectable;
    }
protected static function validateField ( $ fieldObject ) { $ selectable = true ; // If not a selectable field if ( isset ( $ fieldObject -> config [ 'selectable' ] ) && $ fieldObject -> config [ 'selectable' ] === false ) { $ selectable = false ; } if ( isset ( $ fieldObject -> config [ 'privacy' ] ) ) { $ privacyClass = $ fieldObject -> config [ 'privacy' ] ; // If privacy given as a closure if ( is_callable ( $ privacyClass ) && call_user_func ( $ privacyClass , self :: $ args ) === false ) { $ selectable = null ; } // If Privacy class given elseif ( is_string ( $ privacyClass ) ) { if ( array_has ( self :: $ privacyValidations , $ privacyClass ) ) { $ validated = self :: $ privacyValidations [ $ privacyClass ] ; } else { $ validated = call_user_func ( [ app ( $ privacyClass ) , 'fire' ] , self :: $ args ) ; self :: $ privacyValidations [ $ privacyClass ] = $ validated ; } if ( ! $ validated ) { $ selectable = null ; } } } return $ selectable ; }
Check the privacy status, if it's given

@return boolean | null - true, if selectable; false, if not selectable, but allowed;
null, if not allowed
Check the privacy status if it s given