Is the following query possible with Eloquent ORM without using whereRaw()
:
SELECT *
FROM Users
WHERE name="John"
OR name="Bill";
This is the exact problem that I have. I need to find a certain set of specific values from a certain column that is NOT the primary key (and so I cannot use find()
).
However, I would be interested in the more general OR
clause:
SELECT *
FROM Users
WHERE name="John"
OR age="26";
in which you can put any number OR
clauses together, regardless of their content.
As I understand it, chaining multiple ->where()
s will connect them using AND
. I.e.:
User::where("name", "=", "John")
-> where("name", "=", "Bill)
-> get();
produces
SELECT *
FROM Users
WHERE name="John"
AND name="Bill";
Feel free to correct me if I'm wrong.