laravel框架的whereIn条件或者where条件里面的in条件怎么写

1、第一种就是文档中标注的

 $where[] = ['in'=>['tn_user_base.id'=>$medical_number_ids]];

2、第二种 数组方式

$where[] = ['in'=>['tn_user_base.id'=>$medical_number_ids]];
  1. 他匹配的都是数组
  2. $condition[] =['check_doctor_uid','in',$check_doctor_id]; // 这是错误的写法
  3. //in查询应该用whereIn
    $condition[] =['check_doctor_uid','in',$check_doctor_id]; // 错误
    // Illuminate\Database\Query\Builder关于operators定义中,并没有in
    public $operators = [
        '=', '<', '>', '<=', '>=', '<>', '!=',
        'like', 'like binary', 'not like', 'between', 'ilike',
        '&', '|', '^', '<<', '>>',
        'rlike', 'regexp', 'not regexp',
        '~', '~*', '!~', '!~*', 'similar to',
        'not similar to', 'not ilike', '~~*', '!~~*',
    ];
    
    
    //->where($condition) 这种写法有问题
  4.  

3、可以用when方法去写 

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章