【发布时间】:2019-07-11 14:11:19
【问题描述】:
我尝试使用 whereIn 获取促销数据,但查询出错。 在 whereIn 中,如果我让 whereIn('category_id', [123,2323]) 没有错误。
但是当我尝试从 request($data2 = $request->category;) 中获取数据时,我无法与 whereIn 一起使用
$promotions = Promotion::with('product')->with('category')->whereHas(
'category',
function ($q) {
$data2 = $request->category;
$q->whereIn('category_id', $data2);
})
->paginate(9);
【问题讨论】:
标签: laravel