Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Enhancement/Question]: Using sort_order in pivot tables for ManyToMany relationships #7

Open
OliverTe opened this issue Feb 11, 2024 · 0 comments
Labels
bug Something isn't working

Comments

@OliverTe
Copy link

What happened?

Sorry to file a bug report, there is no other possibility to ask a question.

First, thanks for your work. Your plugin works very well for normal resources. What would be a great enhancement, or maybe I am missing something, would be using it for the pivot tables for ManyToMany relationships.

For example: I have ProductCategories, where Products will be related to. This relationship is saved (according to Laravel standards) in a pivot table linking productcategory_id and product_id. I have now added a "sort_order" column to this table and added the DownStep and UpStep actions to the table in the RelationManager. So when opening up a ProductCategory in Filament, the RelationManager table with the associated products is shown correctly, including the UpStep and DownStep links. Unfortunately, the SortOrder model is then expected to be used in the Product model, and not in the model of the pivot table. Consequently, a click on the Upstep/Downstep link will execute a SQL command to change the sort_order column in the product table, which is of course non-existing.
Any advices? Thank you!

How to reproduce the bug

Package Version

1.1.3

PHP Version

8.2.7

Laravel Version

10.43.0

Which operating systems does with happen with?

No response

Notes

No response

@OliverTe OliverTe added the bug Something isn't working label Feb 11, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant