Access collection instance as javascript variable?
I was trying to send collection of following Query:
$monthly_report_chart = DB::table("transactions")
->select(DB::raw("Date(updated_at) as today"),DB::raw("SUM(collected_today) as sum"))
->groupBy(DB::raw('Date(updated_at)'))
->where(DB::raw('Month(updated_at)'),'=',$month)
->get();
And i want to access the collection in javascript like this :
{!! json_encode($monthly_report_chart->today) !!}
But it throws following Error :
Property [today] does not exist on this collection instance
How do access collection instance in javascript?
Thanks!
from Laravel Questions and Answers https://laravelquestions.com/php/access-collection-instance-as-javascript-variable/
via Lzo Media
No comments:
Post a Comment