jeudi 1 août 2019

Laravel API JSON Request change property names

Is there any solutions on how to change property names or attributes of JSON Request in Laravel?

Something like Eloquent API Resources but instead in responses, it will be done in requests before directing to the request validation?

From this,

{
    "agent_reference": "ABC-12345",
    "product_instance_id": "aca68c65-44c3-4ea1-a726-ca183de09a31",
    "add_ons": [
        "string"
    ],
    "transportation": "string",
    "guests": [
        {
        "guest_type_key": "string",
        "add_ons": [
            "string"
        ],
        "field_responses": [
            {
            "key": "string",
            "response": "string"
            }
        ]
        }
    ]
}

To this,

{
    "agent_id": "ABC-12345",
    "plan_id": "aca68c65-44c3-4ea1-a726-ca183de09a31",
    "additional_params": [
        "string"
    ],
    "pickup_place": "string",
    "visitors": [
        {
        "visitor_kty": "string",
        "additional_params": [
            "string"
        ],
        "responses": [
            {
            "id": "string",
            "result": "string"
            }
        ]
        }
    ]
}



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

Aucun commentaire:

Enregistrer un commentaire