0
我有Products
表和Categories
表。Laravel哪裏有一件物品的條件?
每個產品可能有一個或多個附件。爲此我創建了表格:products_caetgories
。
那麼,我怎樣才能設置where
條件哪裏product_category
= 1?
我試着像爲:
Product::with("categories")->where("product_category", 1)->get();
這http://stackoverflow.com/questions/19745512/laravel-selecting-with條件 - 從多對多關係可能會有所幫助 –