Lighthouse: Problem in using `unique` in @rules - undefined table

Created on 16 May 2019  路  3Comments  路  Source: nuwave/lighthouse

Hello everyone;
And thanks for this amazing package!

Describe the bug

When i try to use unique rule using @rules directive in and input schema, it will queries input.[unique column name] instead of just [unique column name].

Expected behavior

The [unique column name] itself must be queried to check if that value exists or not!, not anything else!

Schema

type Mutation {
  registerUser(input: RegisterUserInput! @spread): User! @create @middleware(checks: ["guest"])
}

input RegisterUserInput {
  first_name: String! @rules(apply: ["bail", "required", "string", "max:50"])
  last_name: String! @rules(apply: ["bail", "required", "string", "max:50"])
  email: String! @rules(apply: ["bail", "required", "string", "email", "max:255", "unique:users"])
  password: String! @rules(apply: ["bail", "required", "string", "min:6", "max:50"]) @bcrypt
}

Output/Logs

Click to expand

"debugMessage": "SQLSTATE[42P01]: Undefined table: 7 ERROR:  missing FROM-clause entry for table \"input\"
LINE 1: select count(*) as aggregate from \"users\" where \"input\".\"ema...
(SQL: select count(*) as aggregate from \"users\" where \"input\".\"email\" = [email protected])"


More Details

"message": "Internal server error",
      "extensions": {
        "category": "internal"
      },
      "locations": [
        {
          "line": 2,
          "column": 3
        }
      ],
      "path": [
        "registerUser"
      ],
      "trace": [
        {
          "file": "D:\\Mehran\\Projects\\SuperStar\\SuperStar-Laravel-GraphQL\\vendor\\laravel\\framework\\src\\Illuminate\\Database\\Connection.php",
          "line": 624,
          "call": "Illuminate\\Database\\Connection::runQueryCallback('select count(*) as aggregate from \"users\" where \"input\".\"email\" = ?', array(1), instance of Closure)"
        },
        {
          "file": "D:\\Mehran\\Projects\\SuperStar\\SuperStar-Laravel-GraphQL\\vendor\\laravel\\framework\\src\\Illuminate\\Database\\Connection.php",
          "line": 333,
          "call": "Illuminate\\Database\\Connection::run('select count(*) as aggregate from \"users\" where \"input\".\"email\" = ?', array(1), instance of Closure)"
        },
        {
          "file": "D:\\Mehran\\Projects\\SuperStar\\SuperStar-Laravel-GraphQL\\vendor\\laravel\\framework\\src\\Illuminate\\Database\\Query\\Builder.php",
          "line": 2124,
          "call": "Illuminate\\Database\\Connection::select('select count(*) as aggregate from \"users\" where \"input\".\"email\" = ?', array(1), false)"
        },
        {
          "file": "D:\\Mehran\\Projects\\SuperStar\\SuperStar-Laravel-GraphQL\\vendor\\laravel\\framework\\src\\Illuminate\\Database\\Query\\Builder.php",
          "line": 2112,
          "call": "Illuminate\\Database\\Query\\Builder::runSelect()"
        },
        {
          "file": "D:\\Mehran\\Projects\\SuperStar\\SuperStar-Laravel-GraphQL\\vendor\\laravel\\framework\\src\\Illuminate\\Database\\Query\\Builder.php",
          "line": 2598,
          "call": "Illuminate\\Database\\Query\\Builder::Illuminate\\Database\\Query\\{closure}()"
        },
        {
          "file": "D:\\Mehran\\Projects\\SuperStar\\SuperStar-Laravel-GraphQL\\vendor\\laravel\\framework\\src\\Illuminate\\Database\\Query\\Builder.php",
          "line": 2113,
          "call": "Illuminate\\Database\\Query\\Builder::onceWithColumns(array(1), instance of Closure)"
        },
        {
          "file": "D:\\Mehran\\Projects\\SuperStar\\SuperStar-Laravel-GraphQL\\vendor\\laravel\\framework\\src\\Illuminate\\Database\\Query\\Builder.php",
          "line": 2525,
          "call": "Illuminate\\Database\\Query\\Builder::get(array(1))"
        },
        {
          "file": "D:\\Mehran\\Projects\\SuperStar\\SuperStar-Laravel-GraphQL\\vendor\\laravel\\framework\\src\\Illuminate\\Database\\Query\\Builder.php",
          "line": 2453,
          "call": "Illuminate\\Database\\Query\\Builder::aggregate('count', array(1))"
        },
        {
          "file": "D:\\Mehran\\Projects\\SuperStar\\SuperStar-Laravel-GraphQL\\vendor\\laravel\\framework\\src\\Illuminate\\Validation\\DatabasePresenceVerifier.php",
          "line": 55,
          "call": "Illuminate\\Database\\Query\\Builder::count()"
        },
        {
          "file": "D:\\Mehran\\Projects\\SuperStar\\SuperStar-Laravel-GraphQL\\vendor\\laravel\\framework\\src\\Illuminate\\Validation\\Concerns\\ValidatesAttributes.php",
          "line": 732,
          "call": "Illuminate\\Validation\\DatabasePresenceVerifier::getCount('users', 'input.email', '[email protected]', null, null, array(0))"
        },
        {
          "file": "D:\\Mehran\\Projects\\SuperStar\\SuperStar-Laravel-GraphQL\\vendor\\laravel\\framework\\src\\Illuminate\\Validation\\Validator.php",
          "line": 398,
          "call": "Illuminate\\Validation\\Validator::validateUnique('input.email', '[email protected]', array(1), instance of Nuwave\\Lighthouse\\Execution\\GraphQLValidator)"
        },
        {
          "file": "D:\\Mehran\\Projects\\SuperStar\\SuperStar-Laravel-GraphQL\\vendor\\laravel\\framework\\src\\Illuminate\\Validation\\Validator.php",
          "line": 277,
          "call": "Illuminate\\Validation\\Validator::validateAttribute('input.email', 'Unique')"
        },
        {
          "file": "D:\\Mehran\\Projects\\SuperStar\\SuperStar-Laravel-GraphQL\\vendor\\laravel\\framework\\src\\Illuminate\\Validation\\Validator.php",
          "line": 302,
          "call": "Illuminate\\Validation\\Validator::passes()"
        },
        {
          "file": "D:\\Mehran\\Projects\\SuperStar\\SuperStar-Laravel-GraphQL\\vendor\\nuwave\\lighthouse\\src\\Schema\\Factories\\FieldFactory.php",
          "line": 464,
          "call": "Illuminate\\Validation\\Validator::fails()"
        },
        {
          "file": "D:\\Mehran\\Projects\\SuperStar\\SuperStar-Laravel-GraphQL\\vendor\\nuwave\\lighthouse\\src\\Schema\\Factories\\FieldFactory.php",
          "line": 437,
          "call": "Nuwave\\Lighthouse\\Schema\\Factories\\FieldFactory::validateArgs()"
        },
        {
          "file": "D:\\Mehran\\Projects\\SuperStar\\SuperStar-Laravel-GraphQL\\vendor\\nuwave\\lighthouse\\src\\Schema\\Factories\\FieldFactory.php",
          "line": 187,
          "call": "Nuwave\\Lighthouse\\Schema\\Factories\\FieldFactory::runArgDirectives()"
        },
        {
          "file": "D:\\Mehran\\Projects\\SuperStar\\SuperStar-Laravel-GraphQL\\vendor\\webonyx\\graphql-php\\src\\Executor\\ReferenceExecutor.php",
          "line": 632,
          "call": "Nuwave\\Lighthouse\\Schema\\Factories\\FieldFactory::Nuwave\\Lighthouse\\Schema\\Factories\\{closure}(null, array(1), instance of Nuwave\\Lighthouse\\Schema\\Context, instance of GraphQL\\Type\\Definition\\ResolveInfo)"
        },
        {
          "file": "D:\\Mehran\\Projects\\SuperStar\\SuperStar-Laravel-GraphQL\\vendor\\webonyx\\graphql-php\\src\\Executor\\ReferenceExecutor.php",
          "line": 560,
          "call": "GraphQL\\Executor\\ReferenceExecutor::resolveOrError(instance of GraphQL\\Type\\Definition\\FieldDefinition, instance of GraphQL\\Language\\AST\\FieldNode, instance of Closure, null, instance of Nuwave\\Lighthouse\\Schema\\Context, instance of GraphQL\\Type\\Definition\\ResolveInfo)"
        },
        {
          "file": "D:\\Mehran\\Projects\\SuperStar\\SuperStar-Laravel-GraphQL\\vendor\\webonyx\\graphql-php\\src\\Executor\\ReferenceExecutor.php",
          "line": 478,
          "call": "GraphQL\\Executor\\ReferenceExecutor::resolveField(GraphQLType: Mutation, null, instance of ArrayObject(1), array(1))"
        },
        {
          "file": "D:\\Mehran\\Projects\\SuperStar\\SuperStar-Laravel-GraphQL\\vendor\\webonyx\\graphql-php\\src\\Executor\\ReferenceExecutor.php",
          "line": 921,
          "call": "GraphQL\\Executor\\ReferenceExecutor::GraphQL\\Executor\\{closure}(array(0), 'registerUser')"
        },
        {
          "call": "GraphQL\\Executor\\ReferenceExecutor::GraphQL\\Executor\\{closure}(array(0), 'registerUser')"
        },
        {
          "file": "D:\\Mehran\\Projects\\SuperStar\\SuperStar-Laravel-GraphQL\\vendor\\webonyx\\graphql-php\\src\\Executor\\ReferenceExecutor.php",
          "line": 923,
          "function": "array_reduce(array(1), instance of Closure, array(0))"
        },
        {
          "file": "D:\\Mehran\\Projects\\SuperStar\\SuperStar-Laravel-GraphQL\\vendor\\webonyx\\graphql-php\\src\\Executor\\ReferenceExecutor.php",
          "line": 494,
          "call": "GraphQL\\Executor\\ReferenceExecutor::promiseReduce(array(1), instance of Closure, array(0))"
        },
        {
          "file": "D:\\Mehran\\Projects\\SuperStar\\SuperStar-Laravel-GraphQL\\vendor\\webonyx\\graphql-php\\src\\Executor\\ReferenceExecutor.php",
          "line": 256,
          "call": "GraphQL\\Executor\\ReferenceExecutor::executeFieldsSerially(GraphQLType: Mutation, null, array(0), instance of ArrayObject(1))"
        },
        {
          "file": "D:\\Mehran\\Projects\\SuperStar\\SuperStar-Laravel-GraphQL\\vendor\\webonyx\\graphql-php\\src\\Executor\\ReferenceExecutor.php",
          "line": 208,
          "call": "GraphQL\\Executor\\ReferenceExecutor::executeOperation(instance of GraphQL\\Language\\AST\\OperationDefinitionNode, null)"
        },
        {
          "file": "D:\\Mehran\\Projects\\SuperStar\\SuperStar-Laravel-GraphQL\\vendor\\webonyx\\graphql-php\\src\\Executor\\Executor.php",
          "line": 155,
          "call": "GraphQL\\Executor\\ReferenceExecutor::doExecute()"
        },
        {
          "file": "D:\\Mehran\\Projects\\SuperStar\\SuperStar-Laravel-GraphQL\\vendor\\webonyx\\graphql-php\\src\\GraphQL.php",
          "line": 165,
          "call": "GraphQL\\Executor\\Executor::promiseToExecute(instance of GraphQL\\Executor\\Promise\\Adapter\\SyncPromiseAdapter, instance of GraphQL\\Type\\Schema, instance of GraphQL\\Language\\AST\\DocumentNode, null, instance of Nuwave\\Lighthouse\\Schema\\Context, array(0), null, null)"
        },
        {
          "file": "D:\\Mehran\\Projects\\SuperStar\\SuperStar-Laravel-GraphQL\\vendor\\webonyx\\graphql-php\\src\\GraphQL.php",
          "line": 98,
          "call": "GraphQL\\GraphQL::promiseToExecute(instance of GraphQL\\Executor\\Promise\\Adapter\\SyncPromiseAdapter, instance of GraphQL\\Type\\Schema, 'mutation {\n  registerUser(input: {first_name: \"Mehran\", last_name: \"Abghari\", email: \"[email protected]\", brokerage: \"456654\", password: \"123456\"}) {\n    id\n    email\n  }\n}', null, instance of Nuwave\\Lighthouse\\Schema\\Context, array(0), null, null, array(29))"
        },
        {
          "file": "D:\\Mehran\\Projects\\SuperStar\\SuperStar-Laravel-GraphQL\\vendor\\nuwave\\lighthouse\\src\\GraphQL.php",
          "line": 191,
          "call": "GraphQL\\GraphQL::executeQuery(instance of GraphQL\\Type\\Schema, 'mutation {\n  registerUser(input: {first_name: \"Mehran\", last_name: \"Abghari\", email: \"[email protected]\", brokerage: \"456654\", password: \"123456\"}) {\n    id\n    email\n  }\n}', null, instance of Nuwave\\Lighthouse\\Schema\\Context, array(0), null, null, array(29))"
        },
        {
          "file": "D:\\Mehran\\Projects\\SuperStar\\SuperStar-Laravel-GraphQL\\vendor\\nuwave\\lighthouse\\src\\GraphQL.php",
          "line": 130,
          "call": "Nuwave\\Lighthouse\\GraphQL::executeQuery('mutation {\n  registerUser(input: {first_name: \"Mehran\", last_name: \"Abghari\", email: \"[email protected]\", brokerage: \"456654\", password: \"123456\"}) {\n    id\n    email\n  }\n}', instance of Nuwave\\Lighthouse\\Schema\\Context, array(0), null, null)"
        },
        {
          "file": "D:\\Mehran\\Projects\\SuperStar\\SuperStar-Laravel-GraphQL\\vendor\\nuwave\\lighthouse\\src\\Support\\Http\\Controllers\\GraphQLController.php",
          "line": 79,
          "call": "Nuwave\\Lighthouse\\GraphQL::executeRequest(instance of Nuwave\\Lighthouse\\Execution\\LighthouseRequest)"
        },
        {
          "call": "Nuwave\\Lighthouse\\Support\\Http\\Controllers\\GraphQLController::query(instance of Nuwave\\Lighthouse\\Execution\\LighthouseRequest)"
        },
        {
          "file": "D:\\Mehran\\Projects\\SuperStar\\SuperStar-Laravel-GraphQL\\vendor\\laravel\\framework\\src\\Illuminate\\Routing\\Controller.php",
          "line": 54,
          "function": "call_user_func_array(array(2), array(1))"
        },
        {
          "file": "D:\\Mehran\\Projects\\SuperStar\\SuperStar-Laravel-GraphQL\\vendor\\laravel\\framework\\src\\Illuminate\\Routing\\ControllerDispatcher.php",
          "line": 45,
          "call": "Illuminate\\Routing\\Controller::callAction('query', array(1))"
        },
        {
          "file": "D:\\Mehran\\Projects\\SuperStar\\SuperStar-Laravel-GraphQL\\vendor\\laravel\\framework\\src\\Illuminate\\Routing\\Route.php",
          "line": 219,
          "call": "Illuminate\\Routing\\ControllerDispatcher::dispatch(instance of Illuminate\\Routing\\Route, instance of Nuwave\\Lighthouse\\Support\\Http\\Controllers\\GraphQLController, 'query')"
        },
        {
          "file": "D:\\Mehran\\Projects\\SuperStar\\SuperStar-Laravel-GraphQL\\vendor\\laravel\\framework\\src\\Illuminate\\Routing\\Route.php",
          "line": 176,
          "call": "Illuminate\\Routing\\Route::runController()"
        },
        {
          "file": "D:\\Mehran\\Projects\\SuperStar\\SuperStar-Laravel-GraphQL\\vendor\\laravel\\framework\\src\\Illuminate\\Routing\\Router.php",
          "line": 680,
          "call": "Illuminate\\Routing\\Route::run()"
        },
        {
          "file": "D:\\Mehran\\Projects\\SuperStar\\SuperStar-Laravel-GraphQL\\vendor\\laravel\\framework\\src\\Illuminate\\Routing\\Pipeline.php",
          "line": 30,
          "call": "Illuminate\\Routing\\Router::Illuminate\\Routing\\{closure}(instance of Illuminate\\Http\\Request)"
        },
        {
          "file": "D:\\Mehran\\Projects\\SuperStar\\SuperStar-Laravel-GraphQL\\vendor\\nuwave\\lighthouse\\src\\Support\\Http\\Middleware\\AcceptJson.php",
          "line": 30,
          "call": "Illuminate\\Routing\\Pipeline::Illuminate\\Routing\\{closure}(instance of Illuminate\\Http\\Request)"
        },
        {
          "file": "D:\\Mehran\\Projects\\SuperStar\\SuperStar-Laravel-GraphQL\\vendor\\laravel\\framework\\src\\Illuminate\\Pipeline\\Pipeline.php",
          "line": 163,
          "call": "Nuwave\\Lighthouse\\Support\\Http\\Middleware\\AcceptJson::handle(instance of Illuminate\\Http\\Request, instance of Closure)"
        },
        {
          "file": "D:\\Mehran\\Projects\\SuperStar\\SuperStar-Laravel-GraphQL\\vendor\\laravel\\framework\\src\\Illuminate\\Routing\\Pipeline.php",
          "line": 53,
          "call": "Illuminate\\Pipeline\\Pipeline::Illuminate\\Pipeline\\{closure}(instance of Illuminate\\Http\\Request)"
        },
        {
          "file": "D:\\Mehran\\Projects\\SuperStar\\SuperStar-Laravel-GraphQL\\vendor\\laravel\\framework\\src\\Illuminate\\Pipeline\\Pipeline.php",
          "line": 104,
          "call": "Illuminate\\Routing\\Pipeline::Illuminate\\Routing\\{closure}(instance of Illuminate\\Http\\Request)"
        },
        {
          "file": "D:\\Mehran\\Projects\\SuperStar\\SuperStar-Laravel-GraphQL\\vendor\\laravel\\framework\\src\\Illuminate\\Routing\\Router.php",
          "line": 682,
          "call": "Illuminate\\Pipeline\\Pipeline::then(instance of Closure)"
        },
        {
          "file": "D:\\Mehran\\Projects\\SuperStar\\SuperStar-Laravel-GraphQL\\vendor\\laravel\\framework\\src\\Illuminate\\Routing\\Router.php",
          "line": 657,
          "call": "Illuminate\\Routing\\Router::runRouteWithinStack(instance of Illuminate\\Routing\\Route, instance of Illuminate\\Http\\Request)"
        },
        {
          "file": "D:\\Mehran\\Projects\\SuperStar\\SuperStar-Laravel-GraphQL\\vendor\\laravel\\framework\\src\\Illuminate\\Routing\\Router.php",
          "line": 623,
          "call": "Illuminate\\Routing\\Router::runRoute(instance of Illuminate\\Http\\Request, instance of Illuminate\\Routing\\Route)"
        },
        {
          "file": "D:\\Mehran\\Projects\\SuperStar\\SuperStar-Laravel-GraphQL\\vendor\\laravel\\framework\\src\\Illuminate\\Routing\\Router.php",
          "line": 612,
          "call": "Illuminate\\Routing\\Router::dispatchToRoute(instance of Illuminate\\Http\\Request)"
        },
        {
          "file": "D:\\Mehran\\Projects\\SuperStar\\SuperStar-Laravel-GraphQL\\vendor\\laravel\\framework\\src\\Illuminate\\Foundation\\Http\\Kernel.php",
          "line": 176,
          "call": "Illuminate\\Routing\\Router::dispatch(instance of Illuminate\\Http\\Request)"
        },
        {
          "file": "D:\\Mehran\\Projects\\SuperStar\\SuperStar-Laravel-GraphQL\\vendor\\laravel\\framework\\src\\Illuminate\\Routing\\Pipeline.php",
          "line": 30,
          "call": "Illuminate\\Foundation\\Http\\Kernel::Illuminate\\Foundation\\Http\\{closure}(instance of Illuminate\\Http\\Request)"
        },
        {
          "file": "D:\\Mehran\\Projects\\SuperStar\\SuperStar-Laravel-GraphQL\\vendor\\fideloper\\proxy\\src\\TrustProxies.php",
          "line": 57,
          "call": "Illuminate\\Routing\\Pipeline::Illuminate\\Routing\\{closure}(instance of Illuminate\\Http\\Request)"
        },
        {
          "file": "D:\\Mehran\\Projects\\SuperStar\\SuperStar-Laravel-GraphQL\\vendor\\laravel\\framework\\src\\Illuminate\\Pipeline\\Pipeline.php",
          "line": 163,
          "call": "Fideloper\\Proxy\\TrustProxies::handle(instance of Illuminate\\Http\\Request, instance of Closure)"
        },
        {
          "file": "D:\\Mehran\\Projects\\SuperStar\\SuperStar-Laravel-GraphQL\\vendor\\laravel\\framework\\src\\Illuminate\\Routing\\Pipeline.php",
          "line": 53,
          "call": "Illuminate\\Pipeline\\Pipeline::Illuminate\\Pipeline\\{closure}(instance of Illuminate\\Http\\Request)"
        },
        {
          "file": "D:\\Mehran\\Projects\\SuperStar\\SuperStar-Laravel-GraphQL\\vendor\\laravel\\framework\\src\\Illuminate\\Foundation\\Http\\Middleware\\TransformsRequest.php",
          "line": 21,
          "call": "Illuminate\\Routing\\Pipeline::Illuminate\\Routing\\{closure}(instance of Illuminate\\Http\\Request)"
        },
        {
          "file": "D:\\Mehran\\Projects\\SuperStar\\SuperStar-Laravel-GraphQL\\vendor\\laravel\\framework\\src\\Illuminate\\Pipeline\\Pipeline.php",
          "line": 163,
          "call": "Illuminate\\Foundation\\Http\\Middleware\\TransformsRequest::handle(instance of Illuminate\\Http\\Request, instance of Closure)"
        },
        {
          "file": "D:\\Mehran\\Projects\\SuperStar\\SuperStar-Laravel-GraphQL\\vendor\\laravel\\framework\\src\\Illuminate\\Routing\\Pipeline.php",
          "line": 53,
          "call": "Illuminate\\Pipeline\\Pipeline::Illuminate\\Pipeline\\{closure}(instance of Illuminate\\Http\\Request)"
        },
        {
          "file": "D:\\Mehran\\Projects\\SuperStar\\SuperStar-Laravel-GraphQL\\vendor\\laravel\\framework\\src\\Illuminate\\Foundation\\Http\\Middleware\\TransformsRequest.php",
          "line": 21,
          "call": "Illuminate\\Routing\\Pipeline::Illuminate\\Routing\\{closure}(instance of Illuminate\\Http\\Request)"
        },
        {
          "file": "D:\\Mehran\\Projects\\SuperStar\\SuperStar-Laravel-GraphQL\\vendor\\laravel\\framework\\src\\Illuminate\\Pipeline\\Pipeline.php",
          "line": 163,
          "call": "Illuminate\\Foundation\\Http\\Middleware\\TransformsRequest::handle(instance of Illuminate\\Http\\Request, instance of Closure)"
        },
        {
          "file": "D:\\Mehran\\Projects\\SuperStar\\SuperStar-Laravel-GraphQL\\vendor\\laravel\\framework\\src\\Illuminate\\Routing\\Pipeline.php",
          "line": 53,
          "call": "Illuminate\\Pipeline\\Pipeline::Illuminate\\Pipeline\\{closure}(instance of Illuminate\\Http\\Request)"
        },
        {
          "file": "D:\\Mehran\\Projects\\SuperStar\\SuperStar-Laravel-GraphQL\\vendor\\laravel\\framework\\src\\Illuminate\\Foundation\\Http\\Middleware\\ValidatePostSize.php",
          "line": 27,
          "call": "Illuminate\\Routing\\Pipeline::Illuminate\\Routing\\{closure}(instance of Illuminate\\Http\\Request)"
        },
        {
          "file": "D:\\Mehran\\Projects\\SuperStar\\SuperStar-Laravel-GraphQL\\vendor\\laravel\\framework\\src\\Illuminate\\Pipeline\\Pipeline.php",
          "line": 163,
          "call": "Illuminate\\Foundation\\Http\\Middleware\\ValidatePostSize::handle(instance of Illuminate\\Http\\Request, instance of Closure)"
        },
        {
          "file": "D:\\Mehran\\Projects\\SuperStar\\SuperStar-Laravel-GraphQL\\vendor\\laravel\\framework\\src\\Illuminate\\Routing\\Pipeline.php",
          "line": 53,
          "call": "Illuminate\\Pipeline\\Pipeline::Illuminate\\Pipeline\\{closure}(instance of Illuminate\\Http\\Request)"
        },
        {
          "file": "D:\\Mehran\\Projects\\SuperStar\\SuperStar-Laravel-GraphQL\\vendor\\laravel\\framework\\src\\Illuminate\\Foundation\\Http\\Middleware\\CheckForMaintenanceMode.php",
          "line": 62,
          "call": "Illuminate\\Routing\\Pipeline::Illuminate\\Routing\\{closure}(instance of Illuminate\\Http\\Request)"
        },
        {
          "file": "D:\\Mehran\\Projects\\SuperStar\\SuperStar-Laravel-GraphQL\\vendor\\laravel\\framework\\src\\Illuminate\\Pipeline\\Pipeline.php",
          "line": 163,
          "call": "Illuminate\\Foundation\\Http\\Middleware\\CheckForMaintenanceMode::handle(instance of Illuminate\\Http\\Request, instance of Closure)"
        },
        {
          "file": "D:\\Mehran\\Projects\\SuperStar\\SuperStar-Laravel-GraphQL\\vendor\\laravel\\framework\\src\\Illuminate\\Routing\\Pipeline.php",
          "line": 53,
          "call": "Illuminate\\Pipeline\\Pipeline::Illuminate\\Pipeline\\{closure}(instance of Illuminate\\Http\\Request)"
        },
        {
          "file": "D:\\Mehran\\Projects\\SuperStar\\SuperStar-Laravel-GraphQL\\vendor\\laravel\\framework\\src\\Illuminate\\Pipeline\\Pipeline.php",
          "line": 104,
          "call": "Illuminate\\Routing\\Pipeline::Illuminate\\Routing\\{closure}(instance of Illuminate\\Http\\Request)"
        },
        {
          "file": "D:\\Mehran\\Projects\\SuperStar\\SuperStar-Laravel-GraphQL\\vendor\\laravel\\framework\\src\\Illuminate\\Foundation\\Http\\Kernel.php",
          "line": 151,
          "call": "Illuminate\\Pipeline\\Pipeline::then(instance of Closure)"
        },
        {
          "file": "D:\\Mehran\\Projects\\SuperStar\\SuperStar-Laravel-GraphQL\\vendor\\laravel\\framework\\src\\Illuminate\\Foundation\\Http\\Kernel.php",
          "line": 116,
          "call": "Illuminate\\Foundation\\Http\\Kernel::sendRequestThroughRouter(instance of Illuminate\\Http\\Request)"
        },
        {
          "file": "D:\\Mehran\\Projects\\SuperStar\\SuperStar-Laravel-GraphQL\\public\\index.php",
          "line": 55,
          "call": "Illuminate\\Foundation\\Http\\Kernel::handle(instance of Illuminate\\Http\\Request)"
        },
        {
          "file": "D:\\Mehran\\Projects\\SuperStar\\SuperStar-Laravel-GraphQL\\server.php",
          "line": 21,
          "function": "require_once('D:\\Mehran\\Projects\\SuperStar\\SuperStar-Laravel-GraphQL\\public\\index.php')"
        }
      ]
    }
  ]
}


Environment

Lighthouse Version: ^3.6
Laravel Version: 5.8.*
PHP Version: PHP 7.2.11
Database: Postgresql

Additional context

Nothing for now :)

question

Most helpful comment

Using the unique validation rule can be a bit tricky.

If the argument is nested within an input object, the argument path will not
match the column name, so you have to specify the column name explicitly.

input CreateUserInput {
  email: String @rules(apply: ["unique:users,email_address"])
}

All 3 comments

Using the unique validation rule can be a bit tricky.

If the argument is nested within an input object, the argument path will not
match the column name, so you have to specify the column name explicitly.

input CreateUserInput {
  email: String @rules(apply: ["unique:users,email_address"])
}

Oh, yes i see. Thank you @spawnia !

@spawnia any idea why following is not working?

input CreateUserInput {
    email: String! @rules(apply: ["required", "email", "unique:users,email"])
}
Was this page helpful?
0 / 5 - 0 ratings