jeudi 21 janvier 2016

posting json to laravel 5.1 issue

I am making this post request to laravel (don't mind the syntax)

{
    cart =     {
        "company_id" = 1;
        quantity = 3;
        "service_product_id" = 1;
    };
    options =     (
                {
            "company_id" = 1;
            "service_product_option_id" = 1;
            "service_product_option_value_id" = 2;
        },
                {
            "company_id" = 1;
            "service_product_option_id" = 2;
            "service_product_option_value_id" = 3;
        }
    );
}

this is the request laravel gets ( return $request->all() )

{
    cart =     {
        "company_id" = 1;
        quantity = 3;
        "service_product_id" = 1;
    };
    options =     (
                {
            "company_id" = 1;
        },
                {
            "service_product_option_id" = 1;
        },
                {
            "service_product_option_value_id" = 2;
        },
                {
            "company_id" = 1;
        },
                {
            "service_product_option_id" = 2;
        },
                {
            "service_product_option_value_id" = 3;
        }
    );
}

even though the option array being passed consist two inner objects, it is being processed as 6 different object on laravel end. Why is this and how I can fix this?



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire