F
Filamentβ€’10mo ago
Patrick

Best solution for dynamic Model attribute fields via Relationmanager

Hi all, I am new to Filament and Laravel, trying to get the following working. I have Tenant, CompanyGroup and CompanyGroupAttribute Model. A Tenant should create CompanyGroupAttributes which should then act as Form Fields for CompanyGroup. So I have different CompanyGroupAttributes per Tenant. A CompanyGroup belongs to one Tenant and should have all related CompanyGroupAttributes. The idea behind this is to provide custom attributes to each Tenant for their CompanyGroups. What would be the best implementation for this? Atm I have a belongsToMany relationship for CompanyGroup and CompanyGroupAttribute to have a pivot table to store the value for each custom attribute. However I am struggling to set the pivot table value on CompanyGroup creation in my CompanyGroupRelationManager. I am sure I made a mistake choosing the wrong relations or missing a logic part. Any ideas? Appreciate your help πŸ™‚ Thanks
2 Replies
Clear
Clearβ€’9mo ago
Hi mate, did you figure it out?
Patrick
PatrickOPβ€’9mo ago
Hi @Clear , yes I got it working with my belongsToMany relationship. I still don't know if its the best solution but it works.
Want results from more Discord servers?
Add your server