mardi 5 janvier 2016

Laravel: a model that belongs to two other models

In laravel, is there a way to get the list of objects that belong to two models?

For example,

Model transactions: belongs to users belongs to category

Model user: has many transactions

Model category: has many transactions

Assuming these relationships are correctly defined, what kind of query would you make in, say the controller, to access the set of transactions that belongs to user x and category y?



from Newest questions tagged laravel-5 - Stack Overflow http://ift.tt/1UuXyMf
via IFTTT

Aucun commentaire:

Enregistrer un commentaire