@@ -176,13 +176,14 @@ protected function getValuesFromBindings(array $where, string $values) : string
176
176
{
177
177
// Fallback to this when the current binding does not exist in the bindings array
178
178
$ bindingFallback = __CLASS__ . ':UNKNOWN_BINDING ' ;
179
+ $ currentBinding = $ this ->getCurrentBinding ('where ' ) ?? $ bindingFallback ;
179
180
180
- if (( $ this -> query -> bindings [ " where " ][ $ this -> currentBinding ] ?? $ bindingFallback ) !== $ bindingFallback ) {
181
- $ values = $ this -> query -> bindings [ " where " ][ $ this -> currentBinding ] ;
181
+ if ($ currentBinding !== $ bindingFallback ) {
182
+ $ values = $ currentBinding ;
182
183
$ this ->currentBinding ++;
183
184
184
185
if ($ where ["type " ] === "between " ) {
185
- $ values .= "_ " . $ this ->query -> bindings [ " where " ][ $ this -> currentBinding ] ;
186
+ $ values .= "_ " . $ this ->getCurrentBinding ( ' where ' ) ;
186
187
$ this ->currentBinding ++;
187
188
}
188
189
}
@@ -237,7 +238,7 @@ protected function getInAndNotInClauses(array $where) : string
237
238
238
239
$ type = strtolower ($ where ["type " ]);
239
240
$ subquery = $ this ->getValuesFromWhere ($ where );
240
- $ values = collect ($ this ->query -> bindings [ " where " ][ $ this -> currentBinding ] ?? []);
241
+ $ values = collect ($ this ->getCurrentBinding ( ' where ' ) ?? []);
241
242
242
243
if (Str::startsWith ($ subquery , $ values ->first ())) {
243
244
$ this ->currentBinding += count ($ where ["values " ]);
@@ -298,7 +299,7 @@ protected function getRawClauses(array $where) : string
298
299
299
300
while (count ($ queryParts ) > 1 ) {
300
301
$ clause .= "_ " . array_shift ($ queryParts );
301
- $ clause .= $ this ->query -> bindings [ " where " ][ $ this -> currentBinding ] ;
302
+ $ clause .= $ this ->getCurrentBinding ( ' where ' ) ;
302
303
$ this ->currentBinding ++;
303
304
}
304
305
@@ -365,4 +366,10 @@ protected function getBindingsSlug() : string
365
366
366
367
return Arr::query ($ this ->model ->query ()->getBindings ());
367
368
}
369
+
370
+
371
+ private function getCurrentBinding (string $ type )
372
+ {
373
+ return data_get ($ this ->query ->bindings , "$ type. $ this ->currentBinding " );
374
+ }
368
375
}
0 commit comments