I want to select from the database something like: SELECT * FROM database WHERE id=1 OR id=2 OR id=5;
I do not know the number of the where clauses that the user will request, it can be one, it can be 10.
I tried using Model::orWhere([['id','=',1],['id','=',2],['id','=',5]])
but it seems to be returning an empty list.
In the Laravel
documentation, there is this example for the WHERE
clause:
users = DB::table('users')->where([
['status', '=', '1'],
['subscribed', '<>', '1'],
])->get();
While the WHERE
clause it working as in the example, orWhere
clause doesn't seem to work like this though.