@@ -307,17 +307,6 @@ public function fromRaw($expression, $bindings = [])
307
307
return $ this ;
308
308
}
309
309
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
-
321
310
/**
322
311
* Creates a subquery and parse it.
323
312
*
@@ -709,7 +698,7 @@ public function where($column, $operator = null, $value = null, $boolean = 'and'
709
698
);
710
699
711
700
if (! $ value instanceof Expression) {
712
- $ this ->addBinding ($ this ->scalarValue ($ value ), 'where ' );
701
+ $ this ->addBinding ($ this ->flattenValue ($ value ), 'where ' );
713
702
}
714
703
715
704
return $ this ;
@@ -1122,7 +1111,7 @@ public function whereDate($column, $operator, $value = null, $boolean = 'and')
1122
1111
$ value , $ operator , func_num_args () === 2
1123
1112
);
1124
1113
1125
- $ value = $ this ->scalarValue ($ value );
1114
+ $ value = $ this ->flattenValue ($ value );
1126
1115
1127
1116
if ($ value instanceof DateTimeInterface) {
1128
1117
$ value = $ value ->format ('Y-m-d ' );
@@ -1163,7 +1152,7 @@ public function whereTime($column, $operator, $value = null, $boolean = 'and')
1163
1152
$ value , $ operator , func_num_args () === 2
1164
1153
);
1165
1154
1166
- $ value = $ this ->scalarValue ($ value );
1155
+ $ value = $ this ->flattenValue ($ value );
1167
1156
1168
1157
if ($ value instanceof DateTimeInterface) {
1169
1158
$ value = $ value ->format ('H:i:s ' );
@@ -1204,7 +1193,7 @@ public function whereDay($column, $operator, $value = null, $boolean = 'and')
1204
1193
$ value , $ operator , func_num_args () === 2
1205
1194
);
1206
1195
1207
- $ value = $ this ->scalarValue ($ value );
1196
+ $ value = $ this ->flattenValue ($ value );
1208
1197
1209
1198
if ($ value instanceof DateTimeInterface) {
1210
1199
$ value = $ value ->format ('d ' );
@@ -1249,7 +1238,7 @@ public function whereMonth($column, $operator, $value = null, $boolean = 'and')
1249
1238
$ value , $ operator , func_num_args () === 2
1250
1239
);
1251
1240
1252
- $ value = $ this ->scalarValue ($ value );
1241
+ $ value = $ this ->flattenValue ($ value );
1253
1242
1254
1243
if ($ value instanceof DateTimeInterface) {
1255
1244
$ value = $ value ->format ('m ' );
@@ -1294,7 +1283,7 @@ public function whereYear($column, $operator, $value = null, $boolean = 'and')
1294
1283
$ value , $ operator , func_num_args () === 2
1295
1284
);
1296
1285
1297
- $ value = $ this ->scalarValue ($ value );
1286
+ $ value = $ this ->flattenValue ($ value );
1298
1287
1299
1288
if ($ value instanceof DateTimeInterface) {
1300
1289
$ value = $ value ->format ('Y ' );
@@ -1604,7 +1593,7 @@ public function whereJsonLength($column, $operator, $value = null, $boolean = 'a
1604
1593
$ this ->wheres [] = compact ('type ' , 'column ' , 'operator ' , 'value ' , 'boolean ' );
1605
1594
1606
1595
if (! $ value instanceof Expression) {
1607
- $ this ->addBinding ((int ) $ this ->scalarValue ($ value ));
1596
+ $ this ->addBinding ((int ) $ this ->flattenValue ($ value ));
1608
1597
}
1609
1598
1610
1599
return $ this ;
@@ -1753,7 +1742,7 @@ public function having($column, $operator = null, $value = null, $boolean = 'and
1753
1742
$ this ->havings [] = compact ('type ' , 'column ' , 'operator ' , 'value ' , 'boolean ' );
1754
1743
1755
1744
if (! $ value instanceof Expression) {
1756
- $ this ->addBinding ($ this ->scalarValue ($ value ), 'having ' );
1745
+ $ this ->addBinding ($ this ->flattenValue ($ value ), 'having ' );
1757
1746
}
1758
1747
1759
1748
return $ this ;
@@ -2969,6 +2958,17 @@ protected function cleanBindings(array $bindings)
2969
2958
}));
2970
2959
}
2971
2960
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
+
2972
2972
/**
2973
2973
* Get the default key name of the table.
2974
2974
*
0 commit comments