mardi 29 septembre 2015

Formetting Laravel's Data before returning

I want to have the returning data with a formatting like this -

{
  "cols": [
            {
              "label":"Topping",
              "type":"string"
            },
            {
              "label":"Slices",
              "type":"number"
            }
          ],
  "rows": [
            {
              "c":[
                    {"v":"Mushrooms"},
                    {"v":3}
                  ]
            },
            {
              "c":[
                    {"v":"Onions"},
                    {"v":1}
                  ]
            },
            {
              "c":[
                    {"v":"Olives"},
                    {"v":1}
                  ]
            },
            {
              "c":[
                    {"v":"Zucchini"},
                    {"v":1}
                  ]
            },
            {
              "c":[
                    {"v":"Pepperoni"},
                    {"v":2}
                  ]
            }
          ]
}

Is there any way in Laravel?

Thanks for helping.



from Newest questions tagged laravel-5 - Stack Overflow http://ift.tt/1KHtDxa
via IFTTT

Aucun commentaire:

Enregistrer un commentaire