I tried to send an assembly of the following request:
$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 as follows:
{!! json_encode($monthly_report_chart->today) !!}
But this causes the following error:
The [today] property does not exist in the collection instance.
How is an access collection instance in javascript? Thanks!
source share