lundi 12 février 2018

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!



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire