Oct 31, 2023
0
Level 2
#help RelationShip
i have 3 model
- Categories
- products
- collection
my code
ProductCollection::with(['products' => function($query){
$query->with(['categories' => function($q){
return $q->groupBy('category_product.category_id');
}])->groupBy('collection_products.product_id');
}])->where('id', 5)->has('products')->first();"
products in relation categories and collection collection and categories no relation
i need result like
collection data' ... , and in collection get categories data ... and in categories items data
how i can do it
Please or to participate in this conversation.