saved, deleted, restored) to trigger versioning automatically, reducing boilerplate. Aligns well with event-sourced architectures or systems requiring immutable history.versions table (potential schema complexity).Versionable) for model integration, avoiding tight coupling with core logic. Can be adopted incrementally (e.g., start with critical models).versions table, which may conflict with existing schemas. Publishable migrations allow customization (e.g., adding user_id for accountability).queue:after events).Version::find(100)) may require index optimization on versionable_id and version.spatie/laravel-activitylog integration).created_at to versions table for time-based queries).spatie/laravel-activitylog (simpler, less feature-rich) or custom solutions (e.g., PostgreSQL jsonb snapshots).assertSoftDeleted).versions table schema (e.g., add user_id, ip_address, or metadata columns).use Versionable trait to target models.previousVersion()->revert() in controllers).versions table for performance.withoutEvents() for bulk operations.Version models are handled correctly by APIs (e.g., spatie/laravel-fractal).Versionable hooks.composer require mpociot/versionable.php artisan vendor:publish --tag=versionable-migrations.user_id).php artisan migrate.use Mpociot\Versionable\Traits\Versionable; to target models.versionable() method if needed (e.g., versionable()->withMetadata()).assertModelHasVersion()).VersionCreated events).mpociot/versionable for breaking changes (e.g., Laravel 11 compatibility).VersionObserver extensions).observe() conflicts.versions table queries (e.g., select * from versions where versionable_id = ? order by version desc limit 1).revert() is called in a transaction.\Mpociot\Versionable\Events\VersionCreated::dispatch($version);
previousVersion() vs. Version::find().versions table by versionable_type if >10MHow can I help you explore Laravel packages today?