Support the ongoing development of Laravel.io →
Database Eloquent Installation
Last updated 2 years 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

marcelzutphen liked this reply

1

Sign in to participate in this thread!

Eventy

Your banner here too?

Moderators

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

Your logo here?

Laravel.io

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

© 2024 Laravel.io - All rights reserved.