How to create custom non-eloquent type that is linked to Eloquent type #2541
Unanswered
WordsofDefiance
asked this question in
Q&A
Replies: 1 comment
-
You don't have to build a model. As long as the shape returned by the API matches your GraphQL types and is either an associative array or a plain object with public properties, you can return it as is. If not, you can wrap it in a value object. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
I have a model, User. This user has many Policies, which my app can only access via an API.
It's easy enough to create a custom query that calls the API and returns the type:
But how can I link this to the user model without having an explicitly defined
hasMany
relationship? By using a type resolver? I feel like I could build a model for aProduct
, but that feels janky since there's no actual table that the model would be linked to.the query would look something like this:
Thanks!
Beta Was this translation helpful? Give feedback.
All reactions