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

  • Post author:
  • Post category:其他


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) 这种写法有问题

3、可以用when方法去写



版权声明:本文为jerryyang_2017原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。