I am using lighthouse package for graphql in laravel, i need to declare a type for a model lets say "ClassA", but the type name must be TypeA, what is the best practice to do so?
Asked
Active
Viewed 753 times
-2
-
The question is unclear. Are you trying to do this... `type Query { typea(id: ID @eq): TypeA @find(model: "App\\Models\\ClassA") } type TypeA { }` – Binny V A Jun 22 '19 at 06:06
1 Answers
1
You do not add it on the type itself, you add in in the query. So to follow your example you would do
type TypeA {
...
}
type Query {
typeA(id: ID @eq): TypeA @find(model: "TypeA")
typeAs(): [TypeA] @all(model: "TypeA")
}
You can find it in the docs also.

Oliver Nybroe
- 1,828
- 22
- 30