|
4 | 4 |
|
5 | 5 | use Illuminate\Contracts\Auth\Access\Gate; |
6 | 6 | use Illuminate\Contracts\Auth\Factory as AuthFactory; |
| 7 | +use TheCodingMachine\GraphQLite\Context\Context; |
7 | 8 | use TheCodingMachine\GraphQLite\Exceptions\WebonyxErrorHandler; |
8 | 9 | use TheCodingMachine\GraphQLite\Laravel\Mappers\Parameters\ValidateFieldMiddleware; |
9 | 10 | use TheCodingMachine\GraphQLite\Laravel\Mappers\PaginatorTypeMapper; |
@@ -63,19 +64,20 @@ public function register() |
63 | 64 | return new GraphQLiteController($app[StandardServer::class], $app[HttpMessageFactoryInterface::class], $debug); |
64 | 65 | }); |
65 | 66 |
|
66 | | - $this->app->singleton(StandardServer::class, function (Application $app) { |
| 67 | + $this->app->singleton(StandardServer::class, static function (Application $app) { |
67 | 68 | return new StandardServer($app[ServerConfig::class]); |
68 | 69 | }); |
69 | 70 |
|
70 | | - $this->app->singleton(ServerConfig::class, function (Application $app) { |
| 71 | + $this->app->singleton(ServerConfig::class, static function (Application $app) { |
71 | 72 | $serverConfig = new ServerConfig(); |
72 | 73 | $serverConfig->setSchema($app[Schema::class]); |
73 | 74 | $serverConfig->setErrorFormatter([WebonyxErrorHandler::class, 'errorFormatter']); |
74 | 75 | $serverConfig->setErrorsHandler([WebonyxErrorHandler::class, 'errorHandler']); |
| 76 | + $serverConfig->setContext(new Context()); |
75 | 77 | return $serverConfig; |
76 | 78 | }); |
77 | 79 |
|
78 | | - $this->app->singleton('graphqliteCache', function () { |
| 80 | + $this->app->singleton('graphqliteCache', static function () { |
79 | 81 | if (extension_loaded('apcu') && ini_get('apc.enabled')) { |
80 | 82 | return new \Symfony\Component\Cache\Simple\ApcuCache(); |
81 | 83 | } else { |
|
0 commit comments