I am connecting to a remote database that has been designed poorly but I can't amend it in any way I only have read access to the get the data I need. It has the following structure:
Products
- id
- style_id
- department_id
Brands
- id
- Name
- style_id
- department_id
So as you can see rather than a product just having a brand_id
field it has a style_id
and department_id
that you have to join on in order to find out what brand a product is.
So how would I set up my belongsTo relationship in my Product model in order to achieve this?
via Chebli Mohamed
Aucun commentaire:
Enregistrer un commentaire