src/Schema/Factories/FieldFactory.php
protected function validateArgs(): void
    {
        if (! $this->rules) {
            return;
        }

        $validator = validator(
            $this->args,
            $this->rules,
            $this->messages,
            [
                'root' => $this->root,
                'context' => $this->context,
                // This makes it so that we get an instance of our own Validator class
                'resolveInfo' => $this->resolveInfo,
            ]
        );

        if ($validator->fails()) {
            foreach ($validator->errors()->getMessages() as $key => $errorMessages) {
                foreach ($errorMessages as $errorMessage) {
                    $this->validationErrorBuffer->push($errorMessage, $key);
                }
            }
        }

        $path = implode(
            '.',
            $this->resolveInfo()->path
        );
        $this->validationErrorBuffer->flush(
            "Validation failed for the field [$path]."
        );

        // reset rules and messages
        $this->rules = [];
        $this->messages = [];
    }
protected function validateArgs(): void
    {
        if (! $this->rules) {
            return;
        }

        $validator = validator(
            $this->args,
            $this->rules,
            $this->messages,
            [
                'root' => $this->root,
                'context' => $this->context,
                // This makes it so that we get an instance of our own Validator class
                'resolveInfo' => $this->resolveInfo,
            ]
        );

        if ($validator->fails()) {
            foreach ($validator->errors()->getMessages() as $key => $errorMessages) {
                foreach ($errorMessages as $errorMessage) {
                    $this->validationErrorBuffer->push($errorMessage, $key);
                }
            }
        }

        $path = implode(
            '.',
            $this->resolveInfo()->path
        );
        $this->validationErrorBuffer->flush(
            "Validation failed for the field [$path]."
        );

        // reset rules and messages
        $this->rules = [];
        $this->messages = [];
    }
protected function validateArgs ( ) : void { if ( ! $ this -> rules ) { return ; } $ validator = validator ( $ this -> args , $ this -> rules , $ this -> messages , [ 'root' => $ this -> root , 'context' => $ this -> context , // This makes it so that we get an instance of our own Validator class 'resolveInfo' => $ this -> resolveInfo , ] ) ; if ( $ validator -> fails ( ) ) { foreach ( $ validator -> errors ( ) -> getMessages ( ) as $ key => $ errorMessages ) { foreach ( $ errorMessages as $ errorMessage ) { $ this -> validationErrorBuffer -> push ( $ errorMessage , $ key ) ; } } } $ path = implode ( '.' , $ this -> resolveInfo ( ) -> path ) ; $ this -> validationErrorBuffer -> flush ( "Validation failed for the field [$path]." ) ; // reset rules and messages $ this -> rules = [ ] ; $ this -> messages = [ ] ; }
Run the gathered validation rules on the arguments.

@return void
Run the gathered validation rules on the arguments .