- How do I install revolution/self-ordering in a Laravel app?
- Install it with Composer using composer require revolution/self-ordering, then publish any provided config, migrations, or assets as described in the README. Add the package trait to the Eloquent model that needs sortable position behavior and run the migrations. Before committing, confirm the package's PHP and illuminate/* constraints match your application's versions.
- Which Laravel and PHP versions does revolution/self-ordering support?
- The release dated 2023-08-27 implies a Laravel 10-era constraint set, so verify the composer.json PHP and illuminate/* ranges before adopting it. Run composer why-not against your target stack, such as PHP 8.3 or 8.4 with Laravel 11 or 12, and do a scratch install first. Do not assume compatibility with newer Laravel majors until Composer resolves cleanly and the ordering behavior is exercised.
- How do I move a record within a sortable list?
- The package adds self-ordering behavior to Eloquent models so you can move records within sortable lists while keeping position values consistent. Check the package README or source for the exact move methods and their signatures, since the public API is not fully documented in the provided context. Test moves to the first position, last position, and between neighbors, then assert the resulting position sequence.
- Does revolution/self-ordering work for drag-and-drop ordering in a UI?
- Yes, its stated purpose is to maintain position values for manually sorted data, which fits drag-and-drop or manually ordered lists. Your front end still handles the drag-and-drop interaction and sends the new order or position to your Laravel endpoint. The package then persists and keeps the ordering consistent, provided you verify the exact update API and concurrency behavior.
- Can I scope ordering per tenant, store, or parent record?
- The provided context does not confirm whether ordering is global per table or scoped by a parent, tenant, or store column. Because the package likely ships migrations and schema conventions, inspect the published migration and trait queries before relying on multi-tenant behavior. If scoping is not built in, plan to extend the trait or wrap reorder operations in your own query constraints and tests.
- Is revolution/self-ordering production-ready and actively maintained?
- It has a single maintainer, kawax, about 24 stars, zero dependents, and no public evidence of production use, so treat upstream as effectively frozen. The last release shown is 2023-08-27, which suggests limited ongoing Laravel-version maintenance. Exercise every behavior you depend on and consider vendoring or forking under the MIT license for customer-facing or long-lived applications.
- How does revolution/self-ordering compare to spatie/eloquent-sortable?
- Both packages add sortable position behavior to Eloquent models and aim to keep ordering consistent with minimal configuration. Spatie's package has much broader public adoption, documentation, and issue history, while revolution/self-ordering has very little public production evidence. Compare verified Laravel version support, API fit, and schema conventions before choosing one for a new project.
- What migrations or schema changes does revolution/self-ordering publish?
- The package is expected to publish config, migrations, and possibly assets through standard Laravel package commands. Inspect the published migration to confirm the position column name, type, indexing, and default values it introduces. Reconcile that schema with your primary key type, soft deletes, tenant scoping, and any existing ordering columns before running it in production.
- How should I test ordering behavior and concurrent reorders?
- Write feature tests that create several records, reorder them, and assert the full position sequence after each move. Cover first, last, middle, deletion, and concurrent reorder cases, because the package has no public issue corpus to lean on. Wrap reorder operations in database transactions and consider row locking if multiple users can reorder the same list at once.
- Can I fork or vendor revolution/self-ordering into a closed-source app?
- Yes, the MIT license permits closed-source forks and vendoring. Copying the package into your application namespace or a private VCS fork gives you upgrade control and lets you remove unused behavior, auth, tenancy, or UI assumptions. This is the safer path when the ordering logic touches customer-facing workflows or data you cannot easily migrate later.