我的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();
}
Run Code Online (Sandbox Code Playgroud) 我知道那里有很多帖子,但我真的找不到任何匹配项。我有一个字符串
"com/i598816441262.htm?sourceType=item&ttid=227200"
我想提取 'i' 和 '.' 之后的数字,在示例中为 598816441262,我可以针对整个内容,“/i598816441262”。但我只想要数字,如果我能做一次,我不想做两次。
求求各位大大给点建议!