Hi @JeffreyWay, you need to fix the SQL highlight ;)
Feb 20, 2018
12
Level 23
Where In multiple columns
I have a table with something like this:
dummies
- id
- morphable_type
- morphable_id
And i want to query this table with the Eloquent method whereIn(...):
$values = [
['type_a', 1],
['type_a', 2],
['type_b', 1],
['type_c', 1],
];
$dummies = Dummy::whereIn(['morphable_type', 'morphable_id'], $values)->get();
Any one has any idea how to achieve that ?
Works fine with a direct SQL but not with Eloquent class.
SELECT * FROM `dummy`
WHERE (dummy.morphable_type, dummy.morphable_id)
IN (('type_a', 1), ('type_a', 2), ('type_b', 1), ('type_c', 1))
Please or to participate in this conversation.