我正在尝试通过单击特定类别来显示其类别与我要获取的$id相匹配的所有产品。
我尝试使用->first()和->pluck('name')函数
我试着在CategoriesController中这样做:
public function show($id)
    {
        $category = Category::where('id', $id)->pluck('name');
        $products = Product::where('categorie', $category)->get();
        return view('categories.show')->with('products',$products);
    }ErrorException方法链接不存在。(查看: C:\wamp64\www\gestionPointDeVente\resources\views\categories\show.blade.php) (显示该类别的所有产品的页面)
BadMethodCallException方法链接不存在。在Macroable.php第74行中
非常感谢!
https://stackoverflow.com/questions/56264589
复制相似问题