lundi 14 novembre 2016

Have 2 one to one relationships between the same models

I have a User model & a Sale model. A User can be either a Merchant or Customer.

When a sale is made the sale belongs to a merchant but also to a customer.

I figured I can give the sale a merchant_id & a sale_id and create 2 different relationships in the models.

Just didn't feel right to me. So my question is there a better way to go about this? I'm in a early stage of development. I wouldn't mind changing the database around a bit.

I'm using laravel 5.3



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire