为什么在laravel/graphql/lighthouse应用程序中找不到make:graphql:type User



从laravel网站上的graphql开始

php artisan make:graphql:type UserType
ERROR  There are no commands defined in the "make:graphql" namespace. Did you mean one of these?  
⇂ make  
...

的输出
php artisan  

我有:

graphql-playground
graphql-playground:download-assets         Download the newest version of the GraphQLPlayground assets to serve them locally.

...

lighthouse
lighthouse:cache                           Compile the GraphQL schema and cache it.
lighthouse:clear-cache                     Clear the GraphQL schema cache.
lighthouse:directive                       Create a class for a custom schema directive.
lighthouse:field                           Create a resolver class for a field on a non-root type.
lighthouse:ide-helper                      Create IDE helper files to improve type checking and autocompletion.
lighthouse:interface                       Create a type resolver class for a GraphQL interface type.
lighthouse:mutation                        Create a resolver class for a single field on the root Mutation type.
lighthouse:print-schema                    Compile the GraphQL schema and print the result.
lighthouse:query                           Create a resolver class for a single field on the root Query type.
lighthouse:scalar                          Create a class for a GraphQL scalar type.
lighthouse:subscription                    Create a resolver class for a single field on the root Subscription type.
lighthouse:union                           Create a type resolver class for a GraphQL union type.
lighthouse:validate-schema                 Validate the GraphQL schema definition.
lighthouse:validator                       Create a validator class

和没有任何更多的GraphQL项…

我是否在安装过程中遗漏了一些包?

我需要添加一些自定义图形类型到我的项目吗?我发现课程/文件是相互矛盾的。在https://lighthouse-php.com/6/getting-started/installation.html输入"graphql:type"我什么也没找到。" graphql:type "是一个过时的选项吗?

"laravel/framework": "^9.48.0",
"mll-lab/laravel-graphql-playground": "^2.6",
"nuwave/lighthouse": "^6.6",

没有命令,使用laravel灯塔创建图形模式类型。为了创建一个类型,在目录/graphql上创建一个schemaTypes.graphql,然后在其中写入您想要的类型,如:

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

之后,在下,您可以使用类型进行更改或查询,如:

type Query {
users: [User!]!
user(id: ID!): User
}

查阅有关laravel灯塔基本类型的文档。ps:别忘了把所有的模式都#import到主schema.graphql

相关内容

  • 没有找到相关文章

最新更新