over 9 years ago
In Laravel 4.x we can easily use where condition with OR AND OR .Below is the example of this
Example:
- User::where(function ($query) {
- $query->where('a', '=', 1)
- ->orWhere('b', '=', 1);
- })->where(function ($query) {
- $query->where('c', '=', 1)
- ->orWhere('d', '=', 1);
- });
User::where(function ($query) { $query->where('a', '=', 1) ->orWhere('b', '=', 1); })->where(function ($query) { $query->where('c', '=', 1) ->orWhere('d', '=', 1); });
Here In the above example you can see that User is a model where with OR AND OR.
0 Comment(s)