我需要brands
在特定collection
页面中获取数据,但只有超过 1 个product
。
这是模型之间的关系。
Brand -> HasMany -> Product
Product <= BelongsToMany => Collection
我能够获得所有系列中包含超过 1 种产品的品牌数据,如下所示:
$brands = Brand::has("products")->get(); //this will return all brands that have more than 1 product.
现在我需要在这里添加收藏限制。
我可以从$slug
特定页面获取集合。
$collection = Collection::where("slug", $slug)->first();
谁能帮我如何获取特定收藏页面的品牌?