@@ -397,22 +397,24 @@ public function delete(Query $query)
397
397
* @param array $bindings
398
398
* @return string
399
399
*/
400
- public function shortcut ($ sql , $ bindings )
400
+ public function shortcut ($ sql , & $ bindings )
401
401
{
402
402
// Laravel provides an easy short-cut notation for writing raw WHERE IN
403
403
// statements. If (...) is in the query, it will be replaced with the
404
- // correct number of parameters based on the bindings.
404
+ // correct number of parameters based on the query bindings.
405
405
if (strpos ($ sql , '(...) ' ) !== false )
406
406
{
407
407
for ($ i = 0 ; $ i < count ($ bindings ); $ i ++)
408
408
{
409
- // If the binding is an array, we can just assume it's used to
410
- // fill a " where in" condition, so we will just replace the
411
- // next place-holder in the query with the constraint.
409
+ // If the binding is an array, we can just assume it's used to fill a
410
+ // where in condition, so we'll just replace the next place-holder
411
+ // in the query with the constraint and splice the bindings .
412
412
if (is_array ($ bindings [$ i ]))
413
413
{
414
414
$ parameters = $ this ->parameterize ($ bindings [$ i ]);
415
415
416
+ array_splice ($ bindings , $ i , 1 , $ bindings [$ i ]);
417
+
416
418
$ sql = preg_replace ('~\(\.\.\.\)~ ' , "( {$ parameters }) " , $ sql , 1 );
417
419
}
418
420
}
0 commit comments