rinvex / laravel-attributes

⚠️ [ABANDONED] Rinvex Attributable is a robust, intelligent, and integrated Entity-Attribute-Value model (EAV) implementation for Laravel Eloquent, with powerful underlying for managing entity attributes implicitly as relations with ease. It utilizes the power of Laravel Eloquent, with smooth and seamless integration.
MIT License
433 stars 104 forks source link

Attribute ownership #112

Closed louiscoetzee closed 3 years ago

louiscoetzee commented 4 years ago

Hi, thanks for sharing this. I am interested in using this package in an app where we have multiple companies/tenants. How could I go about storing model attributes for each company. So each company can choose to add custom fields to for example Contact model. I am using company_id field to check the company scope on tables. Thanks.

Omranic commented 3 years ago

Thank you @louiscoetzee for the good question, you can simply add that 'company_id' field to 'attributes' table, then add eloquent scope to filter the query https://laravel.com/docs/8.x/eloquent

It's simple. Also you may check our multi-tenant solution here (which uses similar but different approach than yours) https://github.com/rinvex/laravel-tenants