Created
October 23, 2019 07:23
-
-
Save renepardon/6751168cc12bc9b32f32c7897169d112 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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