Columns should be in an array or as individual parameters. Try:
public function scopeGroupByMonth($query)
{
return $query->select(array('*', DB::raw('MONTH(display_date) as `month`'), DB::raw('YEAR(display_date) as `year`'), DB::raw('sum(value) as `sum`')))
->groupBy('user_id', 'month', 'year');
}
Sign in to participate in this thread!
The Laravel portal for problem solving, knowledge sharing and community building.
The community