lundi 25 janvier 2021

Laravel: Missing data after resource merge

I have two Laravel resources that have the same internal structure, for example:

{
    "data": {
        "object1": [
            "id": 1
            "foo" "bar"
            "items": [
                {
                    "name": "item1"
                    "color": "black"
                }
                {
                    "name": "item2"
                    "color": "blue"
                }
            ]
        ]
    }
}

Each resource has more than one object (i.e object1, object2, etc) and each resource has distinct key names than the other (no key name conflict).

When I return each resource independently, all the data show up as expected, but when I try to merge both (return $resource1->merge($resource2);, some data from resource one objects do not show (such as items)

What am I doing wrong?



from Newest questions tagged laravel-5 - Stack Overflow https://ift.tt/2NAPX78
via IFTTT

Aucun commentaire:

Enregistrer un commentaire