jeudi 30 mars 2017

Dynamically display JSON object in descending order in blade template

I'm trying to display a JSON object in descending order that is returned to my blade template that should look the output below

2007 | 30 | 28 | 5 | 2 | -10
2008 | 55 | 43 | 23 | 0.5 | -1

JSON looks like this

{
    "2007":{
        "number-xx" : "5",
        "number-aa" : "30",
        "number-ef" : "2",
        "number-sa" : "-10",
        "number-ab" : "28",
    },
    "2008":{
        "number-xx" : "-1",
        "number-aa" : "0.5",
        "number-ef" : "23",
        "number-sa" : "55",
        "number-ab" : "43",    
    }
}

So far I have something like this that shows the year and the numbers if I manually declare them so I can't really set it in descending order.

@foreach ($data['quilt_data_obj'] as $year => $obj)
     |  |  |  |  | 
@endforeach

But I'm just not sure how I can get it to show the numbers dynamically in descending order in my blade template.

Any guidance would be appreciated. Thank you!



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire