nova-sortable icon indicating copy to clipboard operation
nova-sortable copied to clipboard

Compatibility with spatie/eloquent-sortable

Open cord opened this issue 6 years ago • 7 comments
trafficstars

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

cord avatar May 02 '19 11:05 cord

Not the same thing, although the end result is the same. Currently not considering joining eloquent-sortable

lilianjin avatar May 02 '19 12:05 lilianjin

@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).

tumispro avatar May 28 '19 09:05 tumispro

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

cord avatar May 28 '19 09:05 cord

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.

tumispro avatar May 28 '19 12:05 tumispro

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?

cord avatar May 28 '19 12:05 cord

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.

tumispro avatar May 28 '19 14:05 tumispro

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.

VTumanov avatar Jul 10 '19 15:07 VTumanov