vendredi 5 mai 2017

How to get data from intermediate table Laravel?

How to get data from third table through model?

I have model Prototype and PrototypeField model.

Where Prototype is:

id | name

Where PrototypeField is:

prototype_id | field_id

Also there is table Field that contains name of fields:

id | name 

How to get names from table Field throught model 'Prototype' where Prototype relative with PrototypeField by:

Prototype.id = PrototypeField.prototype_id

So, Prototype can has one or many PrototypeField.



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire