Weave Code
Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message

Nova Resizable Laravel Package

optimistdigital/nova-resizable

View on GitHub
Deep Wiki
Context7

Getting Started

This package adds drag-and-drop reordering and resizable index columns to Laravel Nova resources. The 1.1.0 release is a maintenance/UX release: a larger resizable drag hit-area, a fix for Nova 3.29+, and routine dependency bumps. There are no breaking changes, so upgrading from 1.0.x is a composer update.

Minimal setup:

  1. composer require the package (follow the README's version constraint — 1.1.0 assumes Nova 3.29 or later).
  2. Publish and run any provided migration/config: php artisan vendor:publish --provider="...ServiceProvider" then php artisan migrate. The migration typically adds the sort column (default sort_order) and, for resizable, nothing at all — widths are a frontend concern.
  3. Add the package's sortable trait to the Eloquent model you want to reorder.
  4. In the corresponding Nova resource, enable sorting (and optionally resizable() on the index fields) and make sure the index query orders by the sort column.

First use case: open a Nova index view, drag a row by its handle, reload the page and confirm the new order persists. If that works, the wiring (trait + resource + migration) is correct; everything else is configuration.

Where to look first: the published config (sort column name, grouping/scope behavior), the trait source for the creating hook that assigns the initial sort value, and the resource's indexQuery — the most common cause of "sorting doesn't work" is a missing orderBy.

Implementation Patterns

Scoped sorting. Most real usage is not a single global list. If you have parent_id, category_id, or a tenant column, configure the package's grouping/scope so sort_order restarts per group. Otherwise moving an item in one category shifts siblings in another.

Appending new records. The trait normally assigns max(sort_order) + 1 on creating. If you create records in bulk (seeders, imports, API batches), either assign sort_order explicitly or insert sequentially — a batch insert bypasses model events and leaves everything at 0/NULL.

Backfilling existing data. After adding the column, backfill before enabling the UI: order by id (or your natural order) within each group and write incrementing values. Doing this in a migration keeps environments consistent.

Resizable columns. Column widths are a per-browser/per-user convenience, not a data feature. Pair them with the resource's default column set so the first load is sensible; don't try to persist widths server-side unless the package exposes that. Expect the widened hit-area from 1.1.0 to make dragging easier on narrow columns.

Ordering in queries. Always mirror the UI order in indexQuery, e.g. ->orderBy('sort_order'), and include the same grouping column. Watch lenses, filters, and relation-manager indexes — each has its own query and needs the same treatment.

Testing. Model factories are the seam: assert that a created model receives the next sort value, and that a reorder operation produces a contiguous 1..n sequence per group. Contiguity matters if you ever compute "move up/down" arithmetic.

Gotchas and Tips

  • Nova 3.29 fix touches internals. The sortable fix works by adapting to Nova's newer index/table component. If you have customized Nova index views or another package overriding the same views, re-test after upgrading. If you're pinned below Nova 3.29, check whether 1.1.0 still supports your version before bumping.
  • Lost updates. Two admins dragging simultaneously will overwrite each other; there's no optimistic locking. For small teams this is fine — for busy admin panels, refresh after save or funnel reorders through a single endpoint that rewrites the whole group.
  • Contiguity drift. Deletes leave gaps in sort_order. If your own code does sort_order - 1 / + 1 swaps, gaps and duplicates will eventually break it; prefer a full reindex of the group on each move.
  • NULL vs 0. Make the column non-nullable with a default, and backfill before shipping, or records with NULL will sort inconsistently across databases.
  • Missing orderBy is the #1 bug report. The drag handle saves a value but the table looks unchanged until you add ordering to indexQuery — and to any custom index/lens you use.
  • Authorization. The reorder endpoint is a Nova route; check it respects your resource policies. A user who can view but not update a resource shouldn't be able to drag it.
  • Performance. max() + 1 per create is fine to tens of thousands of rows; full-group reindexing on every move is O(n) writes. If lists get large, consider fractional/sparse ordering.
  • Extension point. Override the sort column name and the initial-value logic via config/trait methods rather than editing vendor code — 1.1.0's "updated packages" line signals the maintainers keep dependencies current, so you'll be upgrading.
Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
uni-method/symfony-lib
tacticmedia/scim-server-bundle
neika-ai/symfony-bundle
mattleads/agent-publishing-bundle
glavweb/framework-bundle
glavweb/extra-bundle
glavweb/api-bundle
glavweb/admin-bundle
adachsoft/api-version-bundle
elsayed85/laravel-api-exceptions
ouhssini/laravel-demo-mode
daworks/ncloud-outbound-mailer-driver
gp247/cms
ignibyte/aic-gates
nexa-merchant/blog
novasa/laravel-language-center
opencage/geocode
adolfoholzer/parameters
livenetworks/ln-starter
cgv/localized-resource