Apologies, I can't upload my controller code right now but I'm hoping you can help with the info I can give you.
I'm using chart.js
to plot a line graph of data. I'm passing the values from my controller for the data points and the date that matches the date point. The date labels are on the x
axis and the data points are on the y
axis.
In my view I'm receiving the following array from the controller:
["2015-06-01","2015-05-01","2015-04-01","2015-03-01","2015-02-01","2015-01-01"]
Which is then being encoded into JSON. Now, should I be attempting to format the date into something a bit more readable inside the controller or inside the view?
EDIT
This is my piece of code that's sending my weight data to my view:
$weight = Weight::where(compact('user_id', 'gecko_id'))->orderBy('weighed_date', 'desc')->take(7)->get()->reverse();
and then
return view('gecko.show')
->with('gecko', $gecko)
->with('dates', $weight->lists('weighed_date'))
->with('amounts', $weight->lists('gecko_weight'));