First Time Filament Project, stuck on M:M relationship π
Background:
It's my first Filament and Backend-heavy project. *Any help would be immensely appreciated! *
I plan to use Filament dashboard for user input, multiple users can belong to the same org, but will see the same dashboard. All content will only be shown to a single user authenticated as "admin." There can be different orgs.
I want: 1. To have user_id, company_id, role_id saved in my table when I input data on Filament (right now I only have Filament user who inputs data and it's saved in the DB, but M:M table is not filled π¦ ). 2. To find the right plugin on Filament to use for 1-org-many-users-that-can-edit-the-same-inputs scenario (was thinking about this one: https://filamentphp.com/plugins/companies, but I have a feeling this one only works for org=user scenario). 3. To understand how to setup "roles" migration/logic for a Filament project (see 1.3 below). 4. What to do with user migration if I need other fields to register a user (not only name, email and psw, but maybe org_id and phone number)?
I have: 1. Migrations 1.1. Users 1.2 Companies 1.3 Roles 1.4 User_Role (M:M) 2. Filament v.2.17.49 3. Doctrine/dbal I'll be rerunning migrations in the background and try to figure it out in the meantime.
I want: 1. To have user_id, company_id, role_id saved in my table when I input data on Filament (right now I only have Filament user who inputs data and it's saved in the DB, but M:M table is not filled π¦ ). 2. To find the right plugin on Filament to use for 1-org-many-users-that-can-edit-the-same-inputs scenario (was thinking about this one: https://filamentphp.com/plugins/companies, but I have a feeling this one only works for org=user scenario). 3. To understand how to setup "roles" migration/logic for a Filament project (see 1.3 below). 4. What to do with user migration if I need other fields to register a user (not only name, email and psw, but maybe org_id and phone number)?
I have: 1. Migrations 1.1. Users 1.2 Companies 1.3 Roles 1.4 User_Role (M:M) 2. Filament v.2.17.49 3. Doctrine/dbal I'll be rerunning migrations in the background and try to figure it out in the meantime.
4 Replies
im not really sure how to help
lets take this one step at a time and look at a specific problem
whats going wrong with filament when you try and use the many to many relationship? what features did you use? what code did you use?
Thank you so much for reacting!
I setup a second project with clean DB and tried https://filamentphp.com/plugins/companies, for now it works like a charm, but I'm still in the middle of checking things! Will update this post once I figure more things out!
Okay, I was asked to make it more simple and specific, so here's the deal
How to modify (and is it really the best practice) default migrations generated by /plugins/companies?
Background:
I tried to add a simple field in Company migration (which actually worked), however be it dbal or default Filament resource generation, once I run the command and refresh the page I get
Resetting the route cache (solution found upon Googling) did not help. I simply tried to output the field I added in default Companies plugin migration to the dashboard.
I suppose maybe I should just create separate migrations and reference the company_id generated by the Companies plugin?
plugin support should be asked in the specific channel, like #companies
Apologies, will do!