I am trying to display the month name from the query but its not printing.
Below is my query:
$stats = DB::table('leadsheet')
->whereYear('created_at', '>=', $days)
->groupBy('month')
->orderBy('month', 'ASC')
->get([
DB::raw('MONTH(created_at) as month'),
DB::raw('COUNT(*) as value')
]);
And my json data is coming like below :
[{"month":1,"value":380},{"month":2,"value":2146},{"month":3,"value":2008},{"month":4,"value":1399},{"month":5,"value":1719},{"month":6,"value":4497},{"month":7,"value":911},{"month":8,"value":495},{"month":9,"value":691},{"month":10,"value":370},{"month":11,"value":479}]
In this result , i just want to display instead numbers 1 as Jan ,2 as Feb and so on ..but i was trying to give the format for month its not happening.
desired input like as:
{"month":Jan,"value":380}...
Can anybody help me out ?
via Chebli Mohamed
Aucun commentaire:
Enregistrer un commentaire