-
-
Save anonymous/7a2387f18bfa16680505ca5b8244bd39 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
**OrdersTable*** | |
$this->belongsToMany('Products',[ | |
'through'=>'OrderLines', | |
'foreignKey'=>'order_id', | |
'bindingKey'=>'id', | |
]); | |
**OrderLinesTable** | |
$this->belongsTo('Orders', [ | |
'foreignKey' => 'order_id' | |
]); | |
$this->belongsTo('Products',[ | |
'foreignKey' => 'sku', | |
'bindingKey' => 'sku', | |
]); | |
**ProductsTable** | |
$this->belongsToMany('Orders', | |
[ | |
'through'=>'OrderLines', | |
'foreignKey'=>'sku', | |
'bindingKey'=>'sku', | |
]); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment