Search
 
SCRIPT & CODE EXAMPLE
 

PHP

eloquent where in

$users = DB::table('users')->whereIn('id', array(1, 2, 3))->get()
Comment

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);
});
Comment

PREVIOUS NEXT
Code Example
Php :: laravel append parameter to links 
Php :: get previous url symfony 4 in formpage 
Php :: laravel joins eloquent model 
Php :: php showing code in browser 
Php :: php error log 
Php :: reply to wp_mail 
Php :: APP_DEBUG is set to true while APP_ENV is not local 
Php :: how to get yearly chart in laravel 
Php :: How to create and access angular HTTP params in PHP 
Php :: php add element to beginning of associative array 
Php :: drupal 8 user_load 
Php :: laravel get from model first 
Php :: define int variable in php 
Php :: php api method post 
Php :: php get object josn 
Php :: session not working php 
Php :: adding data dynamically to empty array in php 
Php :: greater than or equal to in php 
Php :: check array is associative laravel 
Php :: phpmyadmin centos 8 
Php :: php hello world program 
Php :: same column in and where laravel query 
Php :: max title limit woocommerce product 
Php :: autoload file in laravel 
Php :: laravel get route parameters in blade value 
Php :: install php pdo mysql PHP5.6 alpine-apache 
Php :: limit text length in php 
Php :: for each multiple php 
Php :: Round the number in php 
Php :: get value mentthod get laravel 
ADD CONTENT
Topic
Content
Source link
Name
8+4 =