lundi 19 février 2018

Calculate sum of a field in dingo transformer and show in meta object

I have a transformer which works. but I need to calculate total sum of price field in meta object. First: how can I calculate the total sum of price? Two: how change meta object in dingo transformers? This is the response:

"data": [
    {
        "id": 3,
        "transaction": {
            "id": 2,
            "price": "-150000.00"
        }
    },
    {
        "id": 2,
        "transaction": {
            "id": 1,
            "price": "1550000.00"
        }
    }
],
"meta": {
    "pagination": {
        "total": 2,
        "count": 2,
        "per_page": 10,
        "current_page": 1,
        "total_pages": 1,
        "links": []
    }
}



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire