src/Schema/Factories/DirectiveFactory.php
public function create(string $directiveName, $definitionNode = null): Directive
    {
        $directive = $this->resolve($directiveName) ?? $this->createOrFail($directiveName);

        return $definitionNode
            ? $this->hydrate($directive, $definitionNode)
            : $directive;
    }
public function create(string $directiveName, $definitionNode = null): Directive
    {
        $directive = $this->resolve($directiveName) ?? $this->createOrFail($directiveName);

        return $definitionNode
            ? $this->hydrate($directive, $definitionNode)
            : $directive;
    }
public function create ( string $ directiveName , $ definitionNode = null ) : Directive { $ directive = $ this -> resolve ( $ directiveName ) ?? $ this -> createOrFail ( $ directiveName ) ; return $ definitionNode ? $ this -> hydrate ( $ directive , $ definitionNode ) : $ directive ; }
Create a directive by the given directive name.

@param  string  $directiveName
@param  \GraphQL\Language\AST\TypeSystemDefinitionNode|null  $definitionNode
@return \Nuwave\Lighthouse\Support\Contracts\Directive
Create a directive by the given directive name .