diff --git a/src/Illuminate/Database/Eloquent/Builder.php b/src/Illuminate/Database/Eloquent/Builder.php index dbcd693422c5..f270f3e8c947 100755 --- a/src/Illuminate/Database/Eloquent/Builder.php +++ b/src/Illuminate/Database/Eloquent/Builder.php @@ -241,6 +241,10 @@ public function where($column, $operator = null, $value = null, $boolean = 'and' */ public function orWhere($column, $operator = null, $value = null) { + list($value, $operator) = $this->query->prepareValueAndOperator( + $value, $operator, func_num_args() == 2 + ); + return $this->where($column, $operator, $value, 'or'); } diff --git a/src/Illuminate/Database/Query/Builder.php b/src/Illuminate/Database/Query/Builder.php index 95771a9aa5a7..623c241871a8 100755 --- a/src/Illuminate/Database/Query/Builder.php +++ b/src/Illuminate/Database/Query/Builder.php @@ -583,7 +583,7 @@ protected function addArrayOfWheres($column, $boolean, $method = 'where') * * @throws \InvalidArgumentException */ - protected function prepareValueAndOperator($value, $operator, $useDefault = false) + public function prepareValueAndOperator($value, $operator, $useDefault = false) { if ($useDefault) { return [$operator, '=']; @@ -631,6 +631,10 @@ protected function invalidOperator($operator) */ public function orWhere($column, $operator = null, $value = null) { + list($value, $operator) = $this->prepareValueAndOperator( + $value, $operator, func_num_args() == 2 + ); + return $this->where($column, $operator, $value, 'or'); }