jeudi 28 juillet 2016

Laravel Eloquent - how to relate table to another by two fileds

Having two tables User and Mail

MailTable:

\mail
\--|id
\--|user_id
\--|from_user_id
\--|other_fields

UserTable:

\user
\--|id
\--|name
\--|other_fields

the Mail table is related to user by two fields => user_id and from_user_id, how to use eloquent to fetch data related to user to get inbox and outbox(sent) for one user?



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

Aucun commentaire:

Enregistrer un commentaire