Commit 7e14145d authored by Jens Segers's avatar Jens Segers

Readme

parent 43230579
...@@ -74,12 +74,20 @@ Examples ...@@ -74,12 +74,20 @@ Examples
**Using Where In With An Array** **Using Where In With An Array**
$users = User::whereIn('id', array(1, 2, 3))->get(); $users = User::whereIn('age', array(16, 18, 20))->get();
**Where null**
$users = User::whereNull('updated_at')->get();
**Order By** **Order By**
$users = User::orderBy('name', 'desc')->get(); $users = User::orderBy('name', 'desc')->get();
**Offset & Limit**
$users = User::skip(10)->take(5)->get();
**Advanced Wheres** **Advanced Wheres**
$users = User::where('name', '=', 'John')->orWhere(function($query) $users = User::where('name', '=', 'John')->orWhere(function($query)
...@@ -97,11 +105,11 @@ Selected columns that are not grouped will be aggregated with the $last function ...@@ -97,11 +105,11 @@ Selected columns that are not grouped will be aggregated with the $last function
**Aggregation** **Aggregation**
$total = Order::count();
$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 = User::sum('votes');
$total = Order::count();
**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