Unable to process queries in graphql as included classes is reported as not found
I am using Laravel version 5.8.8 with graphql plugin provided by https://github.com/rebing/graphql-laravel
'GraphQL' => Rebing\GraphQL\Support\Facades\GraphQL::class
Rebing\GraphQL\GraphQLServiceProvider::class,
Graphiql\GraphiqlServiceProvider::class,
You are including the Facade in your config.php
, but you're not yet referring to the facade when you try to access it within one of the files in app/GraphQL/Query
.
After defining your namespace in the file you want to use the Facade from, you will have to add a use statement for your facade:
<?php
namespace App\GraphQL\Query;
use GraphQL;
// ...
If you don't, PHP tries to auto-resolve the namespace of the class call to whatever namespace you are in currently (hence the error about not being able to find App\GraphQL\Query\GraphQL
).