@@ -698,7 +698,7 @@ public function where($column, $operator = null, $value = null, $boolean = 'and'
698
698
);
699
699
700
700
if (! $ value instanceof Expression) {
701
- $ this ->addBinding ($ value , 'where ' );
701
+ $ this ->addBinding (is_array ( $ value ) ? head ( $ value ) : $ value , 'where ' );
702
702
}
703
703
704
704
return $ this ;
@@ -1043,7 +1043,7 @@ public function whereBetween($column, array $values, $boolean = 'and', $not = fa
1043
1043
1044
1044
$ this ->wheres [] = compact ('type ' , 'column ' , 'values ' , 'boolean ' , 'not ' );
1045
1045
1046
- $ this ->addBinding ($ this ->cleanBindings ($ values ), 'where ' );
1046
+ $ this ->addBinding (array_slice ( $ this ->cleanBindings ($ values), 0 , 2 ), 'where ' );
1047
1047
1048
1048
return $ this ;
1049
1049
}
@@ -1111,6 +1111,8 @@ public function whereDate($column, $operator, $value = null, $boolean = 'and')
1111
1111
$ value , $ operator , func_num_args () === 2
1112
1112
);
1113
1113
1114
+ $ value = is_array ($ value ) ? head ($ value ) : $ value ;
1115
+
1114
1116
if ($ value instanceof DateTimeInterface) {
1115
1117
$ value = $ value ->format ('Y-m-d ' );
1116
1118
}
@@ -1150,6 +1152,8 @@ public function whereTime($column, $operator, $value = null, $boolean = 'and')
1150
1152
$ value , $ operator , func_num_args () === 2
1151
1153
);
1152
1154
1155
+ $ value = is_array ($ value ) ? head ($ value ) : $ value ;
1156
+
1153
1157
if ($ value instanceof DateTimeInterface) {
1154
1158
$ value = $ value ->format ('H:i:s ' );
1155
1159
}
@@ -1189,6 +1193,8 @@ public function whereDay($column, $operator, $value = null, $boolean = 'and')
1189
1193
$ value , $ operator , func_num_args () === 2
1190
1194
);
1191
1195
1196
+ $ value = is_array ($ value ) ? head ($ value ) : $ value ;
1197
+
1192
1198
if ($ value instanceof DateTimeInterface) {
1193
1199
$ value = $ value ->format ('d ' );
1194
1200
}
@@ -1232,6 +1238,8 @@ public function whereMonth($column, $operator, $value = null, $boolean = 'and')
1232
1238
$ value , $ operator , func_num_args () === 2
1233
1239
);
1234
1240
1241
+ $ value = is_array ($ value ) ? head ($ value ) : $ value ;
1242
+
1235
1243
if ($ value instanceof DateTimeInterface) {
1236
1244
$ value = $ value ->format ('m ' );
1237
1245
}
@@ -1275,6 +1283,8 @@ public function whereYear($column, $operator, $value = null, $boolean = 'and')
1275
1283
$ value , $ operator , func_num_args () === 2
1276
1284
);
1277
1285
1286
+ $ value = is_array ($ value ) ? head ($ value ) : $ value ;
1287
+
1278
1288
if ($ value instanceof DateTimeInterface) {
1279
1289
$ value = $ value ->format ('Y ' );
1280
1290
}
@@ -1583,7 +1593,7 @@ public function whereJsonLength($column, $operator, $value = null, $boolean = 'a
1583
1593
$ this ->wheres [] = compact ('type ' , 'column ' , 'operator ' , 'value ' , 'boolean ' );
1584
1594
1585
1595
if (! $ value instanceof Expression) {
1586
- $ this ->addBinding ($ value );
1596
+ $ this ->addBinding (( int ) $ value );
1587
1597
}
1588
1598
1589
1599
return $ this ;
@@ -1732,7 +1742,7 @@ public function having($column, $operator = null, $value = null, $boolean = 'and
1732
1742
$ this ->havings [] = compact ('type ' , 'column ' , 'operator ' , 'value ' , 'boolean ' );
1733
1743
1734
1744
if (! $ value instanceof Expression) {
1735
- $ this ->addBinding ($ value , 'having ' );
1745
+ $ this ->addBinding (is_array ( $ value ) ? head ( $ value ) : $ value , 'having ' );
1736
1746
}
1737
1747
1738
1748
return $ this ;
0 commit comments