Commit 97fd865d authored by Jens Segers's avatar Jens Segers

Readme

parent fcf5465f
...@@ -93,10 +93,13 @@ Examples ...@@ -93,10 +93,13 @@ Examples
Distinct requires a field for which to return the distinct values. Distinct requires a field for which to return the distinct values.
$users = User::distinct()->get(array('name')); $users = User::distinct()->get(array('name'));
// or // or
$users = User::distinct('name')->get(); $users = User::distinct('name')->get();
Distinct can be combined with **where**:
$users = User::where('active', true)->distinct('name')->get();
**Advanced Wheres** **Advanced Wheres**
$users = User::where('name', '=', 'John')->orWhere(function($query) $users = User::where('name', '=', 'John')->orWhere(function($query)
...@@ -118,7 +121,11 @@ Selected columns that are not grouped will be aggregated with the $last function ...@@ -118,7 +121,11 @@ Selected columns that are not grouped will be aggregated with the $last function
$price = Order::max('price'); $price = Order::max('price');
$price = Order::min('price'); $price = Order::min('price');
$price = Order::avg('price'); $price = Order::avg('price');
$total = User::sum('votes'); $total = Order::sum('price');
Aggregations can be combined with **where**:
$sold = Orders::where('sold', true)->sum('price');
**Like** **Like**
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment