jeudi 27 juillet 2017

How can I query on 3 tables using has-many-through relationship in Laravel 5.4

I have searched too many posts but still confused. I don't wanna use double query, e.g. first access village info than filtered result.

Table Details

  • Province id, name ....

  • District id, name, prov_id[FK] ....

  • Village id, name, dist_id[FK], status ....

Here my question is that how province can access village info using has-many-through on following criteria,

Table: village where dist_id=some_value and status=some_value.



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire