You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Feb 10, 2019. It is now read-only.
The main difference between versions prior 1.0 and 1.0 is the use of multiple schemas. You will need to update your config to have the following structure:
67
+
68
+
```php
69
+
70
+
'schema' => 'default',
71
+
72
+
'schemas' => [
73
+
'default' => [
74
+
'query' => [
75
+
// Your queries
76
+
],
77
+
'mutation' => [
78
+
// Your muttations
79
+
]
80
+
]
81
+
]
82
+
83
+
```
84
+
85
+
If you want to use routes that can accept schema name, you need to change `routes` to the following:
86
+
87
+
```php
88
+
89
+
'routes' => '{graphql_schema?}',
90
+
91
+
// or if you use different routes for query and mutation
92
+
93
+
'routes' => [
94
+
'query' => 'query/{graphql_schema?}',
95
+
'mutation' => 'mutation/{graphql_schema?}'
96
+
],
97
+
98
+
```
99
+
100
+
The method `GraphQL::addQuery` and `GraphQL::addMutation` has been removed since it doesn't make sense with multiple schemas. You can use the new `GraphQL::addSchema` method to add new schemas.
101
+
64
102
## Usage
65
103
104
+
-[Schemas](#schemas)
66
105
-[Creating a query](#creating-a-query)
67
106
-[Creating a mutation](#creating-a-mutation)
68
107
-[Adding validation to mutation](#adding-validation-to-mutation)
Starting from version 1.0, you can define multiple schemas. Having multiple schemas can be useful if, for example, you want an endpoint that is public and another one that needs authentication.
And that's it. You should be able to query GraphQL with a request to the url `/graphql` (or anything you choose in your config). Try a GET request with the following `query` input
208
318
209
319
```
@@ -238,7 +348,7 @@ For example a mutation to update the password of a user. First you need to defin
238
348
class UpdateUserPasswordMutation extends Mutation {
239
349
240
350
protected $attributes = [
241
-
'name' => 'UpdateUserPassword'
351
+
'name' => 'updateUserPassword'
242
352
];
243
353
244
354
public function type()
@@ -279,22 +389,16 @@ You then add the muation to the `config/graphql.php` configuration file
0 commit comments