Skip to content

Commit

Permalink
Support raw expressions in whereRowValues() (#25117)
Browse files Browse the repository at this point in the history
  • Loading branch information
staudenmeir authored and taylorotwell committed Aug 8, 2018
1 parent 240d904 commit df5e681
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/Illuminate/Database/Query/Builder.php
Original file line number Diff line number Diff line change
Expand Up @@ -1415,7 +1415,7 @@ public function whereRowValues($columns, $operator, $values, $boolean = 'and')

$this->wheres[] = compact('type', 'columns', 'operator', 'values', 'boolean');

$this->addBinding($values);
$this->addBinding($this->cleanBindings($values));

return $this;
}
Expand Down
5 changes: 5 additions & 0 deletions tests/Database/DatabaseQueryBuilderTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -2636,6 +2636,11 @@ public function testWhereRowValues()
$builder = $this->getBuilder();
$builder->select('*')->from('orders')->where('company_id', 1)->orWhereRowValues(['last_update', 'order_number'], '<', [1, 2]);
$this->assertEquals('select * from "orders" where "company_id" = ? or (last_update, order_number) < (?, ?)', $builder->toSql());

$builder = $this->getBuilder();
$builder->select('*')->from('orders')->whereRowValues(['last_update', 'order_number'], '<', [1, new Raw('2')]);
$this->assertEquals('select * from "orders" where (last_update, order_number) < (?, 2)', $builder->toSql());
$this->assertEquals([1], $builder->getBindings());
}

public function testWhereRowValuesArityMismatch()
Expand Down

0 comments on commit df5e681

Please sign in to comment.