PHP Laravel get monthly record with postgres

$installments = Installment::select(
                    DB::raw("(sum(amount)) as total"),
                    DB::raw("(TO_CHAR(installment_date::date, 'mm yyyy')) as monthname")
                )
                ->whereYear('installment_date', date('Y'))
->groupBy('monthname') ->orderBy('monthname','ASC') ->where('sta_rec_id', 1) ->get();

echo $installments;
Previous Post Next Post

Contact Form