Skip to content

Commit 006873d

Browse files
committed
formatting
1 parent c6b8168 commit 006873d

File tree

1 file changed

+19
-19
lines changed

1 file changed

+19
-19
lines changed

src/Illuminate/Database/Query/Builder.php

+19-19
Original file line numberDiff line numberDiff line change
@@ -307,17 +307,6 @@ public function fromRaw($expression, $bindings = [])
307307
return $this;
308308
}
309309

310-
/**
311-
* Returns scalar type value from an unknown type of input.
312-
*
313-
* @param mixed $value
314-
* @return mixed
315-
*/
316-
protected function scalarValue($value)
317-
{
318-
return is_array($value) ? head(Arr::flatten($value)) : $value;
319-
}
320-
321310
/**
322311
* Creates a subquery and parse it.
323312
*
@@ -709,7 +698,7 @@ public function where($column, $operator = null, $value = null, $boolean = 'and'
709698
);
710699

711700
if (! $value instanceof Expression) {
712-
$this->addBinding($this->scalarValue($value), 'where');
701+
$this->addBinding($this->flattenValue($value), 'where');
713702
}
714703

715704
return $this;
@@ -1122,7 +1111,7 @@ public function whereDate($column, $operator, $value = null, $boolean = 'and')
11221111
$value, $operator, func_num_args() === 2
11231112
);
11241113

1125-
$value = $this->scalarValue($value);
1114+
$value = $this->flattenValue($value);
11261115

11271116
if ($value instanceof DateTimeInterface) {
11281117
$value = $value->format('Y-m-d');
@@ -1163,7 +1152,7 @@ public function whereTime($column, $operator, $value = null, $boolean = 'and')
11631152
$value, $operator, func_num_args() === 2
11641153
);
11651154

1166-
$value = $this->scalarValue($value);
1155+
$value = $this->flattenValue($value);
11671156

11681157
if ($value instanceof DateTimeInterface) {
11691158
$value = $value->format('H:i:s');
@@ -1204,7 +1193,7 @@ public function whereDay($column, $operator, $value = null, $boolean = 'and')
12041193
$value, $operator, func_num_args() === 2
12051194
);
12061195

1207-
$value = $this->scalarValue($value);
1196+
$value = $this->flattenValue($value);
12081197

12091198
if ($value instanceof DateTimeInterface) {
12101199
$value = $value->format('d');
@@ -1249,7 +1238,7 @@ public function whereMonth($column, $operator, $value = null, $boolean = 'and')
12491238
$value, $operator, func_num_args() === 2
12501239
);
12511240

1252-
$value = $this->scalarValue($value);
1241+
$value = $this->flattenValue($value);
12531242

12541243
if ($value instanceof DateTimeInterface) {
12551244
$value = $value->format('m');
@@ -1294,7 +1283,7 @@ public function whereYear($column, $operator, $value = null, $boolean = 'and')
12941283
$value, $operator, func_num_args() === 2
12951284
);
12961285

1297-
$value = $this->scalarValue($value);
1286+
$value = $this->flattenValue($value);
12981287

12991288
if ($value instanceof DateTimeInterface) {
13001289
$value = $value->format('Y');
@@ -1604,7 +1593,7 @@ public function whereJsonLength($column, $operator, $value = null, $boolean = 'a
16041593
$this->wheres[] = compact('type', 'column', 'operator', 'value', 'boolean');
16051594

16061595
if (! $value instanceof Expression) {
1607-
$this->addBinding((int) $this->scalarValue($value));
1596+
$this->addBinding((int) $this->flattenValue($value));
16081597
}
16091598

16101599
return $this;
@@ -1753,7 +1742,7 @@ public function having($column, $operator = null, $value = null, $boolean = 'and
17531742
$this->havings[] = compact('type', 'column', 'operator', 'value', 'boolean');
17541743

17551744
if (! $value instanceof Expression) {
1756-
$this->addBinding($this->scalarValue($value), 'having');
1745+
$this->addBinding($this->flattenValue($value), 'having');
17571746
}
17581747

17591748
return $this;
@@ -2969,6 +2958,17 @@ protected function cleanBindings(array $bindings)
29692958
}));
29702959
}
29712960

2961+
/**
2962+
* Get a scalar type value from an unknown type of input.
2963+
*
2964+
* @param mixed $value
2965+
* @return mixed
2966+
*/
2967+
protected function flattenValue($value)
2968+
{
2969+
return is_array($value) ? head(Arr::flatten($value)) : $value;
2970+
}
2971+
29722972
/**
29732973
* Get the default key name of the table.
29742974
*

0 commit comments

Comments
 (0)