Support the ongoing development of Laravel.io →
Database Eloquent Installation
Last updated 3 months ago.
0

So it sounds like what you want is a many-to-many polymorphic. Many People can have many preferences. Many Organization can have many preferences. So you need 2 tables.

preferences
   id
   name

the "pivot" table

preferenceables
   preference_id
   preferenceable_id
   preferenceable_type | string "Employee" or "Organization

The 2nd part of your question I'm a little confused about but it sounds like you can do that as pivot data inside the preferenceables table

1

Sign in to participate in this thread!

LaraJobs

Your banner here too?

Moderators

We'd like to thank these amazing companies for supporting us

Your logo here?

The Laravel portal for problem solving, knowledge sharing and community building.

© 2022 Laravel.io - All rights reserved.