I have the following table layout:
deals:
- id
- price
products:
- id
- name
deal_product:
- id
- deal_id
- product_id
metrics:
- id
- name
metric_product:
- id
- metric_id
- product_id
- value
products and metrics have a many-to-many relationship with a pivot column of value.
deals and products also have a many-to-many relationship.
I can get metrics for a product with $product->metrics, but I want to be able to get all metrics for all products related to a deal, so I could do something like this: $deal->metrics.
It needs to be in relationship format, because they need to be eager loaded for my use case.
Thanks for your help!
via Chebli Mohamed
Aucun commentaire:
Enregistrer un commentaire