nova-sortable
nova-sortable copied to clipboard
Compatibility with spatie/eloquent-sortable
Nice interface!
Would be great if you could make the package compatible with
https://github.com/spatie/eloquent-sortable
as used by https://novapackages.com/packages/naxon/nova-field-sortable
Not the same thing, although the end result is the same. Currently not considering joining eloquent-sortable
@cord Why would you want to use both if I may ask? This package offers the same functionality (and a better implementation if you ask me).
Appears to me as https://github.com/spatie/eloquent-sortable is widely used as it enhances models by sorting capabilities, check out
https://github.com/spatie/eloquent-sortable/blob/master/src/SortableTrait.php
compared to https://github.com/ofcold/nova-sortable/blob/master/src/SortableTrait.php
Ah, I missed that you wanted to make it compatible with a Laravel package instead of specifically a Nova package. I agree then, but I do think it would require users of this package to change their implementation (major and breaking change), which is quite annoying.
correct - using the spatie package it opens more capabilities than just sorting in nova frontend. Maybe you can build a compatibility switch so it would work for both sortable traits?
I'm not affiliated with this package, was just curious :) but this might help clarify your issue for @lilianjin so he can consider to either implement it or close it.
I find problem with this solution, when you update ordering - SortableController.php makes 25 database queries for change sort_order column of every record displayed on page.