My query with whereIn only works with string array and integer array containing number < 10 ( example [1,2,3,4,5,6,7,8,9]
will work ).
This will return an empty collection.
$sql = DB::table('simple_table');
$sql->whereIn('question_id', [10, 12);
And this will return the expected result.
// string array | work
$sql = DB::table('simple_table');
$sql->whereIn('question_id', ['10', '12']);
// integer array containing number < 10 | work
$sql = DB::table('simple_table');
$sql->whereIn('question_id', [1, 2]);
question_id
field is string type.
With Laravel 5.2 and whereIn will work for both string and integer.
Any known issues or changes with whereIn in Laravel 5.8??
UPDATED
// work
DB::select('select * from outbound_questions where question_alias IN (10, 12)')
// not work
DB::select('select * from outbound_questions where question_alias IN (?)', [10])
I updated Laravel to 6.x and PHP 7.3, the issue still there...