diff --git a/composer.json b/composer.json
index 8565de66..350f0893 100644
--- a/composer.json
+++ b/composer.json
@@ -19,14 +19,14 @@
"type": "project",
"require": {
"php": ">=5.5.9",
- "illuminate/support": "5.1.*|5.2.*|5.3.*|5.4.*|5.5.*",
- "webonyx/graphql-php": "~0.10.2"
+ "illuminate/support": "5.1.*|5.2.*|5.3.*|5.4.*|5.5.*|5.6.*",
+ "webonyx/graphql-php": "~0.10|~0.11"
},
"require-dev": {
"fzaninotto/faker": "~1.4",
- "orchestra/testbench": "3.1.*|3.2.*|3.3.*|3.4.*|3.5.*",
- "mockery/mockery": "0.9.*",
- "phpunit/phpunit": "~4.0|~5.0|~5.7|~6.0",
+ "orchestra/testbench": "3.1.*|3.2.*|3.3.*|3.4.*|3.5.*|3.6.*",
+ "mockery/mockery": "0.9.*|1.0.*",
+ "phpunit/phpunit": "~4.0|~5.0|~5.7|~6.0|~7.0",
"satooshi/php-coveralls": "^1.0"
},
"autoload": {
diff --git a/src/Folklore/GraphQL/Console/SchemaCommand.php b/src/Folklore/GraphQL/Console/SchemaCommand.php
index 53006e3e..9e2036bc 100644
--- a/src/Folklore/GraphQL/Console/SchemaCommand.php
+++ b/src/Folklore/GraphQL/Console/SchemaCommand.php
@@ -4,7 +4,6 @@
use Illuminate\Console\Command;
use Illuminate\Filesystem\Filesystem;
-use GraphQL;
class SchemaCommand extends Command
{
@@ -24,7 +23,7 @@ class SchemaCommand extends Command
* @var string
*/
protected $description = 'Generate a graphql schema';
-
+
/**
* Filesystem instance for fs operations
*
@@ -35,7 +34,7 @@ class SchemaCommand extends Command
public function __construct(Filesystem $files)
{
parent::__construct();
-
+
$this->files = $files;
}
@@ -50,15 +49,15 @@ public function handle()
if (empty($schema)) {
$schema = config('graphql.schema');
}
-
- $return = GraphQL::introspection($schema);
+
+ $return = app('graphql')->introspection($schema);
$json = json_encode($return, JSON_PRETTY_PRINT);
-
+
if ($this->option('output')) {
echo $json;
return;
}
-
+
$defaultPath = config('graphql.introspection.schema_output', base_path('resources/graphql/schema.json'));
$path = $this->option('path') ? $this->option('path'):$defaultPath;
$dirname = dirname($path);
@@ -66,7 +65,7 @@ public function handle()
$this->files->makeDirectory($dirname, 0775, true);
$this->line('Created: Parent directory '.$dirname);
}
-
+
$this->files->put($path, $json);
$this->line('Created: Schema at '.$path);
}
diff --git a/src/Folklore/GraphQL/LumenServiceProvider.php b/src/Folklore/GraphQL/LumenServiceProvider.php
index c0cad515..505f736b 100644
--- a/src/Folklore/GraphQL/LumenServiceProvider.php
+++ b/src/Folklore/GraphQL/LumenServiceProvider.php
@@ -9,7 +9,7 @@ class LumenServiceProvider extends ServiceProvider
*/
protected function getRouter()
{
- return $this->app;
+ return property_exists($this->app, 'router') ? $this->app->router : $this->app;
}
/**
diff --git a/src/Folklore/GraphQL/Relay/ConnectionEdgeType.php b/src/Folklore/GraphQL/Relay/ConnectionEdgeType.php
index 6fb72531..70eb0bc3 100644
--- a/src/Folklore/GraphQL/Relay/ConnectionEdgeType.php
+++ b/src/Folklore/GraphQL/Relay/ConnectionEdgeType.php
@@ -7,7 +7,7 @@
class ConnectionEdgeType extends BaseType
{
- protected function fields()
+ public function fields()
{
return [
'cursor' => [
diff --git a/src/Folklore/GraphQL/Relay/Console/ConnectionMakeCommand.php b/src/Folklore/GraphQL/Relay/Console/ConnectionMakeCommand.php
index cd26dfdf..eacb844b 100644
--- a/src/Folklore/GraphQL/Relay/Console/ConnectionMakeCommand.php
+++ b/src/Folklore/GraphQL/Relay/Console/ConnectionMakeCommand.php
@@ -2,7 +2,7 @@
namespace Folklore\GraphQL\Relay\Console;
-use Folklore\GraphQL\Console\GeneratorCommand;
+use Illuminate\Console\GeneratorCommand;
class ConnectionMakeCommand extends GeneratorCommand
{
diff --git a/src/Folklore/GraphQL/Relay/Console/InputMakeCommand.php b/src/Folklore/GraphQL/Relay/Console/InputMakeCommand.php
index 76537d31..00ac452b 100644
--- a/src/Folklore/GraphQL/Relay/Console/InputMakeCommand.php
+++ b/src/Folklore/GraphQL/Relay/Console/InputMakeCommand.php
@@ -2,7 +2,7 @@
namespace Folklore\GraphQL\Relay\Console;
-use Folklore\GraphQL\Console\GeneratorCommand;
+use Illuminate\Console\GeneratorCommand;
class InputMakeCommand extends GeneratorCommand
{
diff --git a/src/Folklore/GraphQL/Relay/Console/MutationMakeCommand.php b/src/Folklore/GraphQL/Relay/Console/MutationMakeCommand.php
index 62a97014..8d55d822 100644
--- a/src/Folklore/GraphQL/Relay/Console/MutationMakeCommand.php
+++ b/src/Folklore/GraphQL/Relay/Console/MutationMakeCommand.php
@@ -2,7 +2,7 @@
namespace Folklore\GraphQL\Relay\Console;
-use Folklore\GraphQL\Console\GeneratorCommand;
+use Illuminate\Console\GeneratorCommand;
class MutationMakeCommand extends GeneratorCommand
{
diff --git a/src/Folklore/GraphQL/Relay/Console/NodeMakeCommand.php b/src/Folklore/GraphQL/Relay/Console/NodeMakeCommand.php
index 06a5f193..98b14a9b 100644
--- a/src/Folklore/GraphQL/Relay/Console/NodeMakeCommand.php
+++ b/src/Folklore/GraphQL/Relay/Console/NodeMakeCommand.php
@@ -2,7 +2,7 @@
namespace Folklore\GraphQL\Relay\Console;
-use Folklore\GraphQL\Console\GeneratorCommand;
+use Illuminate\Console\GeneratorCommand;
class NodeMakeCommand extends GeneratorCommand
{
diff --git a/src/Folklore/GraphQL/Relay/Console/PayloadMakeCommand.php b/src/Folklore/GraphQL/Relay/Console/PayloadMakeCommand.php
index af692705..52f8fc94 100644
--- a/src/Folklore/GraphQL/Relay/Console/PayloadMakeCommand.php
+++ b/src/Folklore/GraphQL/Relay/Console/PayloadMakeCommand.php
@@ -2,7 +2,7 @@
namespace Folklore\GraphQL\Relay\Console;
-use Folklore\GraphQL\Console\GeneratorCommand;
+use Illuminate\Console\GeneratorCommand;
class PayloadMakeCommand extends GeneratorCommand
{
diff --git a/src/Folklore/GraphQL/Relay/Console/stubs/input.stub b/src/Folklore/GraphQL/Relay/Console/stubs/input.stub
index 2fe737d8..0de8b90f 100644
--- a/src/Folklore/GraphQL/Relay/Console/stubs/input.stub
+++ b/src/Folklore/GraphQL/Relay/Console/stubs/input.stub
@@ -13,7 +13,7 @@ class DummyClass extends BaseInputType
'description' => 'A relay mutation input type'
];
- protected function fields()
+ public function fields()
{
return [
diff --git a/src/Folklore/GraphQL/Relay/Console/stubs/mutation.stub b/src/Folklore/GraphQL/Relay/Console/stubs/mutation.stub
index 57400165..a0276078 100644
--- a/src/Folklore/GraphQL/Relay/Console/stubs/mutation.stub
+++ b/src/Folklore/GraphQL/Relay/Console/stubs/mutation.stub
@@ -18,7 +18,7 @@ class DummyClass extends BaseMutation
return null;
}
- protected function type()
+ public function type()
{
return null;
}
diff --git a/src/Folklore/GraphQL/Relay/Console/stubs/node.stub b/src/Folklore/GraphQL/Relay/Console/stubs/node.stub
index fdd533ac..1dfce5c7 100644
--- a/src/Folklore/GraphQL/Relay/Console/stubs/node.stub
+++ b/src/Folklore/GraphQL/Relay/Console/stubs/node.stub
@@ -13,7 +13,7 @@ class DummyClass extends BaseNodeType
'description' => 'A relay node type'
];
- protected function fields()
+ public function fields()
{
return [
'id' => [
diff --git a/src/Folklore/GraphQL/Relay/Console/stubs/payload.stub b/src/Folklore/GraphQL/Relay/Console/stubs/payload.stub
index 9f4a1e5d..d98d7dc2 100644
--- a/src/Folklore/GraphQL/Relay/Console/stubs/payload.stub
+++ b/src/Folklore/GraphQL/Relay/Console/stubs/payload.stub
@@ -13,7 +13,7 @@ class DummyClass extends BasePayloadType
'description' => 'A relay mutation payload type'
];
- protected function fields()
+ public function fields()
{
return [
diff --git a/src/Folklore/GraphQL/Relay/NodeIdField.php b/src/Folklore/GraphQL/Relay/NodeIdField.php
index a7c2c197..aeda542b 100644
--- a/src/Folklore/GraphQL/Relay/NodeIdField.php
+++ b/src/Folklore/GraphQL/Relay/NodeIdField.php
@@ -14,7 +14,7 @@ class NodeIdField extends BaseField
'description' => 'A relay node id field'
];
- protected function type()
+ public function type()
{
return Type::nonNull(Type::id());
}
diff --git a/src/Folklore/GraphQL/Relay/NodeInterface.php b/src/Folklore/GraphQL/Relay/NodeInterface.php
index b940bb6a..f602ee16 100644
--- a/src/Folklore/GraphQL/Relay/NodeInterface.php
+++ b/src/Folklore/GraphQL/Relay/NodeInterface.php
@@ -13,7 +13,7 @@ class NodeInterface extends BaseInterfaceType
'description' => 'The relay node interface'
];
- protected function fields()
+ public function fields()
{
return [
'id' => [
diff --git a/src/Folklore/GraphQL/Relay/NodeQuery.php b/src/Folklore/GraphQL/Relay/NodeQuery.php
index 37416573..cc769e04 100644
--- a/src/Folklore/GraphQL/Relay/NodeQuery.php
+++ b/src/Folklore/GraphQL/Relay/NodeQuery.php
@@ -17,12 +17,12 @@ class NodeQuery extends Query
'description' => 'A query'
];
- protected function type()
+ public function type()
{
return app('graphql')->type('Node');
}
- protected function args()
+ public function args()
{
return [
'id' => [
diff --git a/src/Folklore/GraphQL/Relay/PageInfoType.php b/src/Folklore/GraphQL/Relay/PageInfoType.php
index 3be7a130..9f490ed4 100644
--- a/src/Folklore/GraphQL/Relay/PageInfoType.php
+++ b/src/Folklore/GraphQL/Relay/PageInfoType.php
@@ -13,7 +13,7 @@ class PageInfoType extends BaseType
'description' => 'The relay pageInfo type used by connections'
];
- protected function fields()
+ public function fields()
{
return [
'hasNextPage' => [
diff --git a/src/Folklore/GraphQL/Relay/Support/ConnectionType.php b/src/Folklore/GraphQL/Relay/Support/ConnectionType.php
index 79a90af1..e4362aa2 100644
--- a/src/Folklore/GraphQL/Relay/Support/ConnectionType.php
+++ b/src/Folklore/GraphQL/Relay/Support/ConnectionType.php
@@ -19,7 +19,7 @@ protected function edgeType()
return null;
}
- protected function fields()
+ public function fields()
{
return [
'total' => [
diff --git a/src/Folklore/GraphQL/Relay/Support/Mutation.php b/src/Folklore/GraphQL/Relay/Support/Mutation.php
index 3498546a..2619ec81 100644
--- a/src/Folklore/GraphQL/Relay/Support/Mutation.php
+++ b/src/Folklore/GraphQL/Relay/Support/Mutation.php
@@ -25,7 +25,7 @@ public function setInputType($inputType)
$this->inputType = $inputType;
}
- protected function args()
+ public function args()
{
return [
'input' => [
diff --git a/src/Folklore/GraphQL/Relay/Support/Traits/ResolvesFromQueryBuilder.php b/src/Folklore/GraphQL/Relay/Support/Traits/ResolvesFromQueryBuilder.php
index 2b61b5b8..699c6dd7 100644
--- a/src/Folklore/GraphQL/Relay/Support/Traits/ResolvesFromQueryBuilder.php
+++ b/src/Folklore/GraphQL/Relay/Support/Traits/ResolvesFromQueryBuilder.php
@@ -137,7 +137,12 @@ public function resolve($root, $args)
$offset = max(0, $offset);
$limit = min($count - $offset, $limit);
- $query->skip($offset)->take($limit);
+ if ($offset) {
+ $query->skip($offset);
+ }
+ if ($limit) {
+ $query->take($limit);
+ }
$hasNextPage = ($offset + $limit) < $count;
$hasPreviousPage = $offset > 0;
diff --git a/src/resources/graphql/introspectionQuery.txt b/src/resources/graphql/introspection.txt
similarity index 100%
rename from src/resources/graphql/introspectionQuery.txt
rename to src/resources/graphql/introspection.txt