Using selectRaw with aggregate function, where, orderBy, groupBy, take and get

UserPoint::selectRaw("TRUNCATE(SUM(amount),2) as summ, COUNT(id) as cnt")
->where('archive', 0)
->orderBy("dat",desc)
->groupBy("dat")
->take(13)
->get()

Related Posts


Using WhereIn

Updating multiple rows

Using Like

Using orWhere

What is Query Builder?

Using "with" in eloquent query

Getting last inserted id

Selecting last row of a table

Using parameters in find() method

Using local scope in eloquent

Using global scope in eloquent