Commit e3f64f45 authored by Alexandre Butynski's avatar Alexandre Butynski

orderBy() accept uppercase order direction

parent 9829d49e
......@@ -268,7 +268,7 @@ class Builder extends \Illuminate\Database\Query\Builder {
*/
public function orderBy($column, $direction = 'asc')
{
$this->orders[$column] = ($direction == 'asc' ? 1 : -1);
$this->orders[$column] = (strtolower($direction) == 'asc' ? 1 : -1);
return $this;
}
......
......@@ -142,6 +142,9 @@ class QueryTest extends PHPUnit_Framework_TestCase {
$user = User::whereNotNull('age')->orderBy('age', 'asc')->first();
$this->assertEquals(13, $user->age);
$user = User::whereNotNull('age')->orderBy('age', 'ASC')->first();
$this->assertEquals(13, $user->age);
$user = User::whereNotNull('age')->orderBy('age', 'desc')->first();
$this->assertEquals(37, $user->age);
}
......
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