找不到“bcrypt”指令

Ale*_*pov 0 laravel graphql laravel-lighthouse

我正在关注有关如何将 GraphQl 设置到我的项目中的 Lighthouse 官方文档。不幸的是,我遇到了以下错误:

No directive found for `bcrypt`

到目前为止我创建的架构如下:


type Query {
    users: [User!]! @paginate(defaultCount: 10)
    user(id: ID @eq): User @find
}

type User {
    id: ID!
    name: String!
    email: String!
    created_at: DateTime!
    updated_at: DateTime!
}

type Mutation {
    createUser(
        name: String!,
        email: String! @rules(apply: ["email", "unique:users"])
        password: String! @bcrypt
    ): User @create
}
Run Code Online (Sandbox Code Playgroud)

我尝试执行的查询如下:

mutation {
  createUser(
    name:"John Doe"
    email:"john@test.com"
    password: "somesupersecret"
  ) {
    id
    email
  }
}
Run Code Online (Sandbox Code Playgroud)

Ale*_*pov 5

@brypt好的,挖出来了 - \vendor\nuwave\lighthouse\src\Schema\Directives\ 中不再有目录,而是有@hash一个指令,它像魅力一样工作并使用您在config/hashing.php配置文件中指定的驱动程序