Laravel框架中 orwhere 多条件查询的使用
laravel框架中orwhere 多条件查询 如下:
$data = DB::table(group)
->join(group_users as gu,group.group_id,=,gu.group_id)
->where([gu.user_id=>$uid])
->where(function($query){
$query->where(is_super,1)
->orwhere(function($query){
$query->where(is_super,2);
});
})
->orderBy(group.group_id, desc)
->select(group.group_id,group.group_name,group.type_id,group.logo)
->get();
$customer_info=DB::table(customer as c)
->leftJoin(customer_details as cd,c.customer_id,=,cd.customer_id)
->leftJoin(costomer_linkman as cl,c.customer_id,=,cl.customer_id)
->whereIn(c.user_id,$userIdarr)
->where($where_two)
->where(function($query){
$query->where(cd.deal_status,0)
->orwhere(cd.deal_status,null);
})
->where(c.customer_name,like,%.$customer_name.%)
->select(c.customer_id,c.user_id,c.customer_name,cl.linkman_phone,cd.intention_level_id,c.add_time)
->paginate($limit);
上一篇:
IDEA上Java项目控制台中文乱码
