Custom page many-to-many sync() method creates duplicates (is this really the right way to do it?)
Filament/Laravel Newbie.
I want:
To store M:M relationship "company_prefecture" in MySQL DB through a pivot Custom Page.
I have:
A messy code that I want to improve and adjust it to Filament Custom Page conventions.
1) It duplicates entries 2) It does not generate timestamps even though I have those specified in migration I tried: 1. Raw SQL queries (worked) 2. save()/new CompanyPrefecturesModel/fill() approach (couldn't store company_id/prefecture_id, but did manage to generate timestamps this way) 3. sync() (managed to generate entries in my pivot table, but have issues described above) Code: Believe it or not, I've spent a month of my post-work time trying to make it work...
1) It duplicates entries 2) It does not generate timestamps even though I have those specified in migration I tried: 1. Raw SQL queries (worked) 2. save()/new CompanyPrefecturesModel/fill() approach (couldn't store company_id/prefecture_id, but did manage to generate timestamps this way) 3. sync() (managed to generate entries in my pivot table, but have issues described above) Code: Believe it or not, I've spent a month of my post-work time trying to make it work...
0 Replies