我想从产品表中获得cat_id = [1,2,3] AND sub_id = [7,8]的结果我使用以下代码,但不适用于我]
$cat=[1,2,3];
$sub=[7,8];
$products = Product::whereIn('cat_id', $cat)->whereIn('sub_id',$sub)->latest()->paginate(10);
尝试orwherein
$cat=[1,2,3];
$sub=[7,8];
$products = DB::table('products')->whereIn('cat_id', $cat)->orwhereIn('sub_id',$sub)->latest()->paginate(10);