我的http://localhost:8888/VGL/public/category/18?sty=3
当dd($request->sty);
等于 3
但是我$request->sty
输入的whereHas
是
未定义变量:请求
public function show(Request $request, $id)
{
$products = Product::with('features')
->whereHas('features', function ($q) {
return $q->where('id', $request->sty);
})
->where('category_id',17)
->get();
}