Skip to content

Commit 380d3fb

Browse files
BasMuldersrebing
authored andcommitted
Allow subscription types to be added (#84)
Based on @petecoop's PR at the @Folkloreatelier repo (folkloreinc/laravel-graphql@70707ec).
1 parent 74968a3 commit 380d3fb

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

Diff for: src/Rebing/GraphQL/GraphQL.php

+9-3
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@ public function schema($schema = null)
4646

4747
$schemaQuery = array_get($schema, 'query', []);
4848
$schemaMutation = array_get($schema, 'mutation', []);
49+
$schemaSubscription = array_get($schema, 'subscription', []);
4950
$schemaTypes = array_get($schema, 'types', []);
5051

5152
//Get the types either from the schema, or the global types.
@@ -71,11 +72,16 @@ public function schema($schema = null)
7172
$mutation = $this->objectType($schemaMutation, [
7273
'name' => 'Mutation'
7374
]);
75+
76+
$subscription = $this->objectType($schemaSubscription, [
77+
'name' => 'Subscription'
78+
]);
7479

7580
return new Schema([
76-
'query' => $query,
77-
'mutation' => !empty($schemaMutation) ? $mutation : null,
78-
'types' => $types
81+
'query' => $query,
82+
'mutation' => !empty($schemaMutation) ? $mutation : null,
83+
'subscription' => !empty($schemaSubscription) ? $subscription : null,
84+
'types' => $types
7985
]);
8086
}
8187

0 commit comments

Comments
 (0)