tha07
5 months ago

Validating Nested Array of Objects

Posted 5 months ago by tha07

I have a nested array of objects that each object needed to be validated. The request array look like this.

{
    "total" : 250.00,
    "merchant_id" : 1,
    "discount" : 0,
    "items" :  {
        [id: 1, quantity: 25, notes: "some string A"],
        [id: 2, quantity: 10, notes: "some string B"],
        [id: 3, quantity: 5, notes: "some string C"]
    }
}

I know how to validate a nested array. but this has array of objects that each one needed to be validated. how can this be done through Laravel?

Please sign in or create an account to participate in this conversation.