Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[10.x] Database Expressions that are conditions #47210

Merged
merged 3 commits into from
May 30, 2023
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
formatting
  • Loading branch information
taylorotwell committed May 30, 2023
commit 0faf741f937c23ce4c5bcefc9452891752a28641
8 changes: 2 additions & 6 deletions src/Illuminate/Database/Query/Builder.php
Original file line number Diff line number Diff line change
@@ -754,11 +754,9 @@ public function mergeWheres($wheres, $bindings)
*/
public function where($column, $operator = null, $value = null, $boolean = 'and')
{
// If the column is a condition expression, we can skip the normal handling
// of parameters. Such a value indicates that the column contains a where
// condition that can be directly embedded into the query.
if ($column instanceof ConditionExpression) {
$type = 'Expression';

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

return $this;
@@ -2094,11 +2092,9 @@ public function having($column, $operator = null, $value = null, $boolean = 'and
{
$type = 'Basic';

// If the column is a condition expression, we can skip the normal handling
// of parameters. Such a value indicates that the column contains a having
// condition that can be directly embedded into the query.
if ($column instanceof ConditionExpression) {
$type = 'Expression';

$this->havings[] = compact('type', 'column', 'boolean');

return $this;