I am using graphql in laravel project
every thing work fine at localhost but when i deploy to server namecheap i faced this problime
Target class [AppGraphQlTypesAdminCitiesType] does not exist.
"exception": "IlluminateContractsContainerBindingResolutionException",
I am using Postman for request to graphql
this is my type
<?php
namespace AppGraphQlTypesAdmin;
use AppModelsCities;
use GraphQLTypeDefinitionType;
use RebingGraphQLSupportType as GraphQLType;
class CitiesType extends GraphQLType
{
protected $attributes = [
"name" => "CityType",
"description" => "City",
"model" => Cities::class,
];
public function fields(): array
{
return [
"id" => [
"type" => Type::int(),
],
"name" => [
"type" => Type::string(),
],
"google_name" => [
"type" => Type::string(),
],
"fee" => [
"type" => Type::string(),
],
"from" => [
"type" => Type::string(),
],
"to" => [
"type" => Type::string(),
],
"is_active" => [
"type" => Type::boolean(),
],
];
}
}
?>
this is my query
<?php
namespace AppGraphQlQueriesAdmin;
use AppModelsCities;
use RebingGraphQLSupportFacadesGraphQL;
use RebingGraphQLSupportQuery;
use GraphQLTypeDefinitionType;
class CitiesQuery extends Query{
protected $attributes = ['name' => 'cities'];
public function type(): Type
{
return Type::listOf(GraphQL::type("CityType"));
}
public function args(): array{
return[
'id' => [
'name' => 'id',
'type' => Type::int(),
]
];
}
public function resolve($root, $args){
return Cities::where('is_active','0')->get();
}
}
?>
this is
config/graphql.php
<?php
declare(strict_types = 1);
return [
'route' => [
'prefix' => 'graphql',
'controller' => RebingGraphQLGraphQLController::class . '@query',
'middleware' => [],
'group_attributes' => [],
],
'default_schema' => 'default',
'batching' => [
'enable' => true,
],
'schemas' => [
'default' => [
'query' => [
'cities' => AppGraphQlQueriesAdminCitiesQuery::class,
],
'mutation' => [
],
'types' => [
AppGraphQlTypesAdminCitiesType::class
],
'middleware' => null,
'method' => ['GET', 'POST'],
'execution_middleware' => null,
],
],
'types' => [
AppGraphQlTypesAdminCitiesType::class
],
'error_formatter' => [RebingGraphQLGraphQL::class, 'formatError'],
'errors_handler' => [RebingGraphQLGraphQL::class, 'handleErrors'],
'security' => [
'query_max_complexity' => null,
'query_max_depth' => null,
'disable_introspection' => false,
],
'pagination_type' => RebingGraphQLSupportPaginationType::class,
'simple_pagination_type' => RebingGraphQLSupportSimplePaginationType::class,
'defaultFieldResolver' => null,
'headers' => [],
'json_encoding_options' => 0,
'apq' => [
'enable' => env('GRAPHQL_APQ_ENABLE', false),
'cache_driver' => env('GRAPHQL_APQ_CACHE_DRIVER', config('cache.default')),
'cache_prefix' => config('cache.prefix') . ':graphql.apq',
'cache_ttl' => 300,
],
'execution_middleware' => [
RebingGraphQLSupportExecutionMiddlewareValidateOperationParamsMiddleware::class,
RebingGraphQLSupportExecutionMiddlewareAutomaticPersistedQueriesMiddleware::class,
RebingGraphQLSupportExecutionMiddlewareAddAuthUserContextValueMiddleware::class,
],
];