2

Can i insert multi on same mutation?

I wonder this is exist or not.

This is my Schema

type Test {
    id: ID
    name: String
    msg: String
}

input testInput {
    name: String
    msg: String
}

type Mutation {
    createTest(input: [testInput]): [Test] @create
}

This is my mutation query

mutation{
    createTest(input: [
        {id:1,  name: "test", msg:"hahaha",},
        {id:2, name: "test2", msg:"hahahaa" }
    ]) {
        id
        name
        msg
    }
}
Jeongkuk Seo
  • 127
  • 2
  • 15

1 Answers1

2

You can use a custom mutation:

php artisan lighthouse:mutation CreateTest

If you want something reusable, you might want to implement a custom field resolver directive. Look into the implementation of @create for an idea on how that can be done.

spawnia
  • 879
  • 6
  • 13