Lomkit / laravel-rest-api

Generate Api in seconds
https://laravel-rest-api.lomkit.com/
MIT License
298 stars 18 forks source link

Update existing pivot fields #71

Closed davecut closed 8 months ago

davecut commented 8 months ago

Description

Hello,

I was wondering how one can update a field of an already existing row in a pivot table using mutate.

I was using this body, but my request was considered as a new attach and it threw an error.

{
    "mutate": [
        {
            "operation": "update",
            "key": 1,
            "relations": {
                "posts": [
                    {
                        "operation": "update",
                        "key": 5,
                        "pivot": { "number": 20 }
                    },
                ]
            }
        }
    ]
}

Is there anything that can be done to achieve this pivot field update?

Thanks in advance :)

GautierDele commented 8 months ago

Hello @davecut,

Your issue relates to #68 which required to implement new operation in order to allow this kind of operation 😄 Will be implementend soon