Skip to content

Persistence

The package stores per-user datagrid settings in the datagrid_config table.

Persisted settings include:

  • selected page limit
  • visible columns

Settings are persisted only for authenticated users. Guests keep runtime/session state and do not create rows in datagrid_config.

Authenticated users are identified by the string value of auth()->id(). This supports both integer IDs and string/UUID primary keys without requiring a foreign key to your application's users table.

For 1.0.0, persisted settings use the user_identifier column. If you are upgrading from a version that used user_id, run the package migrations before deploying the new code. The upgrade migration backfills user_identifier from user_id, removes the old user_id column, and adds a unique index for datagrid_id plus user_identifier.

The migration is auto-loaded by default. You may publish it if your application needs custom indexes or table changes:

php artisan vendor:publish --tag=livewire-datatables-migrations

The default migration intentionally does not add a hard foreign key to users.id, so the package can work with custom auth schemas.