Skip to content

Instantly share code, notes, and snippets.

@renepardon
Created October 23, 2019 07:23
Show Gist options
  • Save renepardon/6751168cc12bc9b32f32c7897169d112 to your computer and use it in GitHub Desktop.
Save renepardon/6751168cc12bc9b32f32c7897169d112 to your computer and use it in GitHub Desktop.
<?php
namespace App\Graphql\Directives;
use Nuwave\Lighthouse\Schema\Directives\BaseDirective;
use Nuwave\Lighthouse\Support\Contracts\DefinedDirective;
/**
* Class KeyDirective
*
* @package App\Graphql\Directives
*/
class KeyDirective extends BaseDirective implements DefinedDirective
{
/**
* @return string
*/
public function name(): string
{
return 'key';
}
/**
* @return string
*/
public static function definition(): string
{
return /* @lang GraphQL */
<<<'SDL'
directive @key(
fields: String!
) on OBJECT | INTERFACE
SDL;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment