How to import belongsToMany fields in the filament importer?
The getColumns() has the 3 users table fields on the top followed by the related user_company (pivot table) fields i.e. company_employee_id and company_employee_budget allong with the company name from the companies table commented out.
How to I ensure that I am able to add a user and then find the company by name and attach that company with the newly inserted or updated user?
5 Replies
Hi! I think is easier to use hooks and overwrite the saveRecord function in order to handle everything you need or as a last resource. Good luck!
@jagato0 can you elaborate more on the approach please?
@headbanger did you find an answer? I'm looking for a way to do the same, but can't get the before save to even respond to a dd() to debug it
@_andypeacock I had to resort to using an external package to make this work
you can use the
beforeSave
hook