laravelnormalquery我试图使它动态化,而不必像这样再次编写所有查询
$type = .... some time 0 or 1 or 2 $user= User::where('type',$type)->get();
我想要的是给$type值来获取所有用户的类型0、1或2,比如select中的'*'
myss37ts1#
试试这个: $user= User::whereIn('type',[0,1,2])->get();
$user= User::whereIn('type',[0,1,2])->get();
1条答案
按热度按时间myss37ts1#
试试这个:
$user= User::whereIn('type',[0,1,2])->get();