Skip to content

Commit df5e681

Browse files
staudenmeirtaylorotwell
authored andcommitted
Support raw expressions in whereRowValues() (#25117)
1 parent 240d904 commit df5e681

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

src/Illuminate/Database/Query/Builder.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -1415,7 +1415,7 @@ public function whereRowValues($columns, $operator, $values, $boolean = 'and')
14151415

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

1418-
$this->addBinding($values);
1418+
$this->addBinding($this->cleanBindings($values));
14191419

14201420
return $this;
14211421
}

tests/Database/DatabaseQueryBuilderTest.php

+5
Original file line numberDiff line numberDiff line change
@@ -2636,6 +2636,11 @@ public function testWhereRowValues()
26362636
$builder = $this->getBuilder();
26372637
$builder->select('*')->from('orders')->where('company_id', 1)->orWhereRowValues(['last_update', 'order_number'], '<', [1, 2]);
26382638
$this->assertEquals('select * from "orders" where "company_id" = ? or (last_update, order_number) < (?, ?)', $builder->toSql());
2639+
2640+
$builder = $this->getBuilder();
2641+
$builder->select('*')->from('orders')->whereRowValues(['last_update', 'order_number'], '<', [1, new Raw('2')]);
2642+
$this->assertEquals('select * from "orders" where (last_update, order_number) < (?, 2)', $builder->toSql());
2643+
$this->assertEquals([1], $builder->getBindings());
26392644
}
26402645

26412646
public function testWhereRowValuesArityMismatch()

0 commit comments

Comments
 (0)