Aggregates
The query builder also provides a variety of aggregate methods such as count
, max
, min
, and sum
. These methods take the headache out of setting up these common aggregate functions.
When executing any of the aggregate functions, any where
restrictions on your query will still be applied.
Instead of returning a query, these methods return a simple value.
exists
Returns true
if the query returns any rows. Returns false
otherwise.
existsOrFail
Returns true
if the query returns any rows. Throws a RecordNotFound
exception otherwise.
count
Returns an integer number of rows returned by the query.
max
Returns the maximum value for the given column.
min
Returns the minimum value for the given column.
sum
Returns the sum of all returned rows for the given column.
sumRaw
Returns the sum of all returned rows for the expression.
columnList
Retrieves the columns for the configured table.
Last updated