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方法去寫 

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