Hi everyone,
Solved:
Solved with the help of @benheimberg
here https://stackoverflow.com/questions/62304716/how-to-create-nested-relationships-in-laravel-lighthouse-and-vue-apollo/62305347#62305347
Th repos are here
You can play with this whole project by cloning my repos https://github.com/wolfiton/booksql-laravel backend
https://github.com/wolfiton/booksql-vue frontend
mutation (
$categoryId: ID!
)
createBook(
input:
category: {connect: $categoryId]
}
Update: Before someone will say that I can do this
category: Int!
category: $category
variables: {
$category: this.categoryId,
},
Unfortunately I can't because the backend framewok requires me to send the mutation like this
variables: {
$category: { connect: this.categoryId },
},
So any help is apreciated.
I was working graphql an I need to define the following type:
category: {connect:ID!}
mutation (
$title: String!
$image: String!
$author: String!
$description: String!
$link: String!
$featured: Boolean
$category: { connect: Int! }
)
{
createBook(
input: {
title: $title
image: $image
author: $author
description: $description
link: $link
featured: $featured
category: $category
}
) {
id
title
author
}
}
My form uses model to recieve the data for the connect from a select.
I dont know how to define this variable for my mutation:
variables: {
$category: { connect: this.categoryId },
},
I need to replace this:
$category: { connect: Int! }
with something like this
$category: { connect: this.categoryId }
Does someone know how i can define this type?
Thanks in advance
Top comments (0)