#relationship with multiple columns?

4 messages · Page 1 of 1 (latest)

hushed jewel
#

Hey,
i want to archive the following:

One User can have a Company.
This Company can have Many Branches.

No Problem sofar.

Now i have a Address Table. This table should be for Branches and Companys.
So for me i need a address_type and a "primary_id" column for the companyid or branchid.

how i can archieve that? can i somehow tell the company model that the company has one Address where primary_id column is the company id and address_type needs to be 1?

i hope you understand what i want. i dont want to have 2 tables with same columns ( like company_Address and branch_address )

mellow karma
hushed jewel
#

sounds like what i want @mellow karma will try that

#

will give feedback after i tested it