Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit ba86dd4

Browse files
committed
Merge pull request laravel#3733 from anlutro-pull-requests/fix/elq-nested-where-return
Don't return underlying query builder
2 parents 902974d + e26731f commit ba86dd4

2 files changed

Lines changed: 10 additions & 1 deletion

File tree

src/Illuminate/Database/Eloquent/Builder.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -599,7 +599,7 @@ public function where($column, $operator = null, $value = null, $boolean = 'and'
599599
}
600600
else
601601
{
602-
return call_user_func_array(
602+
call_user_func_array(
603603
array($this->query, 'where'), array_slice(func_get_args(), 0, func_num_args())
604604
);
605605
}

tests/Database/DatabaseEloquentBuilderTest.php

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -383,6 +383,15 @@ public function testRealNestedWhereWithScopes()
383383
}
384384

385385

386+
public function testSimpleWhere()
387+
{
388+
$builder = $this->getBuilder();
389+
$builder->getQuery()->shouldReceive('where')->once()->with('foo', '=', 'bar');
390+
$result = $builder->where('foo', '=', 'bar');
391+
$this->assertEquals($result, $builder);
392+
}
393+
394+
386395
protected function mockConnectionForModel($model, $database)
387396
{
388397
$grammarClass = 'Illuminate\Database\Query\Grammars\\'.$database.'Grammar';

0 commit comments

Comments
 (0)