Tag: graphql-php
-
“Extract” mutation name from an “OperationDefinitionNode” Object?
1 I am using the webonyx/graphql-php and Laravel. I have a single middleware that "catches" all graphql requests and I would like to apply some logic to filter some requests depending if the request is a mutation and which mutation it is. I "intersect" the graphql query (similar to this one) where the mutation storeCC…
-
getting started in graphql-php: how to add resolver functions to schema from .graphql file?
5 I’m totally new to GraphQL and wanted to play around with graphql-php in order to build a simple API to get started. I’m currently reading the docs and trying out the examples, but I’m stuck quite at the beginning. I want my schema to be stored in a schema.graphql file instead of building it…
-
How to properly serve custom queries with @method directive in lighthouse-php?
1 I am building an inventory application with lighthouse and struggling to grasp the concept of serving custom queries with complex logic on demand. This is and approximate query that I am trying to create: { statsReport { dailyTotalSales dailyAverageSales dailTotalItemsSold newDailyCustomersCount etc. } } I was thinking of creating an Obejct that would have…
-
How to query all the GraphQL type fields without writing a long query?
316 Assume you have a GraphQL type and it includes many fields. How to query all the fields without writing down a long query that includes the names of all the fields? For example, If I have these fields : public function fields() { return [ ‘id’ => [ ‘type’ => Type::nonNull(Type::string()), ‘description’ => ‘The…