diff --git a/Plugin.php b/Plugin.php index b89840f..30e061f 100644 --- a/Plugin.php +++ b/Plugin.php @@ -15,6 +15,18 @@ class Plugin extends PluginBase public function registerSettings() { + return [ + 'settings' => [ + 'label' => 'germanairlinesva.graphql::lang.settings.label', + 'description' => 'germanairlinesva.graphql::lang.settings.description', + 'category' => 'system::lang.system.categories.cms', + 'icon' => 'icon-compress', + 'class' => 'GermanAirlinesVa\Graphql\Models\Settings', + 'order' => 1000, + 'keywords' => 'graphql', + 'permissions' => ['germanairlinesva.graphql.schemas'] + ] + ]; } public function boot() @@ -49,7 +61,7 @@ class Plugin extends PluginBase { foreach ($options['providers'] as $provider) { - App::register($provider); + App::register($provider); } } @@ -58,7 +70,7 @@ class Plugin extends PluginBase { foreach ($options['aliases'] as $alias => $path) { - $aliasLoader->alias($alias, $path); + $aliasLoader->alias($alias, $path); } } } diff --git a/classes/SchemaSourceProvider.php b/classes/SchemaSourceProvider.php index 9ed8261..b1c83c7 100644 --- a/classes/SchemaSourceProvider.php +++ b/classes/SchemaSourceProvider.php @@ -72,11 +72,11 @@ class SchemaSourceProvider implements LighthouseSchemaSourceProvider // root types $schema = ' type Query { - graphql: Boolean + dummy: Boolean } type Mutation { - graphql: Boolean + dummy: Boolean } '; // schema diff --git a/config/config.php b/config/config.php index 0c704dc..bcb325e 100644 --- a/config/config.php +++ b/config/config.php @@ -1,6 +1,7 @@ [ @@ -71,7 +72,7 @@ return [ */ 'cache' => [ - 'enable' => false, + 'enable' => Settings::get('enable_cache', false), 'key' => env('GRAPHQL_CACHE_KEY', 'graphql-schema'), 'ttl' => env('GRAPHQL_CACHE_TTL', null), ], @@ -189,7 +190,7 @@ return [ | */ - 'batched_queries' => true, + 'batched_queries' => Settings::get('batched_queries', true), /* |-------------------------------------------------------------------------- diff --git a/lang/en/lang.php b/lang/en/lang.php index da63717..56b3d59 100644 --- a/lang/en/lang.php +++ b/lang/en/lang.php @@ -6,4 +6,26 @@ 'menu' => [ 'main' => 'GraphQL', ], -]; \ No newline at end of file + 'permission' => [ + 'tab' => [ + 'schemas' => 'Schemas', + ], + 'label' => [ + 'schemas' => 'Manage schemas', + ], + ], + 'settings' => [ + 'label' => 'German Airlines VA - GraphQL', + 'description' => 'Configure GrapQL', + 'general' => 'General', + 'engine' => 'Engine', + 'enable_cache' => [ + 'label' => 'Enable Schema Cache', + 'comment' => 'A large part of the Schema generation is parsing the various graph definition into an AST. These operations are pretty expensive so it is recommended to enable caching in production mode.' + ], + 'batched_queries' => [ + 'label' => 'Batched Queries', + 'comment' => 'GraphQL query batching means sending multiple queries to the server in one request. You may set this flag to process/deny batched queries.' + ] + ], +]; diff --git a/models/Settings.php b/models/Settings.php new file mode 100644 index 0000000..e3ae7cb --- /dev/null +++ b/models/Settings.php @@ -0,0 +1,15 @@ +