Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PHP

Laravel Eloquent Query Using WHERE with OR AND OR?

Make use of Logical Grouping (Laravel 7.x/4.2). For your example, it'd be something like this:

Model::where(function ($query) {
    $query->where('a', '=', 1)
          ->orWhere('b', '=', 1);
})->where(function ($query) {
    $query->where('c', '=', 1)
          ->orWhere('d', '=', 1);
});
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #Laravel #Eloquent #Query #Using #WHERE #OR #AND
ADD COMMENT
Topic
Name
1+7 =