laravel-graphql icon indicating copy to clipboard operation
laravel-graphql copied to clipboard

Create querries and mutations anonymously

Open tylergets opened this issue 6 years ago • 0 comments

I will submit a PR for this if the team believe its a good addition.

Currently you can create types anonymously like this

GraphQL::addType(new class extends BaseType {
            protected $attributes = [
                'name' => 'HeartRate',
                'description' => 'A type'
            ];

            public function fields()
            {
                return [
                    'uuid' => [
                        'type' => Type::ID()
                    ],
                    'pulse' => [
                        'type' => Type::string()
                    ]
                ];
            }
        });

It would be nice to be able to do this for querries and mutations as well, however there is no way to access the underlying instance object for the querries or mutations.

tylergets avatar Apr 11 '18 16:04 tylergets