i have 2 tables namely users , employers . match them tinder style, means when both user , employer liked each other , each receive notification .
however not sure how relationship
table like??
right have in relationship
table ,
1.user_id
2.target_employer_id
3.employer_id
4.target_user_id
if not wrong , considered many - many relationship. , table correct???
as understand question, in application, user can employer, , employer can user.
if right, seems clear me there 2 distinct (many many) relationships (user => employer, employer => user), , in proposed table 2 fields filled @ time.
the best way represent relationships use 2 tables.
user employer fields:
- user_id
- target_employer_id
employer user fields:
- employer_id
- target_user_id
depending if using laravel 4 or laravel 5, can use 1 of 2 packages generate 2 pivot tables via migration:
Comments
Post a Comment