Skip to content

Commit

Permalink
Allow subscription types to be added (#84)
Browse files Browse the repository at this point in the history
Based on @petecoop's PR at the @Folkloreatelier repo (folkloreinc/laravel-graphql@70707ec).
  • Loading branch information
BasMulders authored and rebing committed Feb 28, 2018
1 parent 74968a3 commit 380d3fb
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions src/Rebing/GraphQL/GraphQL.php
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ public function schema($schema = null)

$schemaQuery = array_get($schema, 'query', []);
$schemaMutation = array_get($schema, 'mutation', []);
$schemaSubscription = array_get($schema, 'subscription', []);
$schemaTypes = array_get($schema, 'types', []);

//Get the types either from the schema, or the global types.
Expand All @@ -71,11 +72,16 @@ public function schema($schema = null)
$mutation = $this->objectType($schemaMutation, [
'name' => 'Mutation'
]);

$subscription = $this->objectType($schemaSubscription, [
'name' => 'Subscription'
]);

return new Schema([
'query' => $query,
'mutation' => !empty($schemaMutation) ? $mutation : null,
'types' => $types
'query' => $query,
'mutation' => !empty($schemaMutation) ? $mutation : null,
'subscription' => !empty($schemaSubscription) ? $subscription : null,
'types' => $types
]);
}

Expand Down

0 comments on commit 380d3fb

Please sign in to comment.