revisionable.saved, revisionable.deleted), enabling hooks for custom logic (e.g., triggering notifications, syncing with external systems).revisions), which may not scale for complex queries (e.g., filtering by specific field changes). Requires raw SQL or custom scopes for advanced use cases.Revisionable trait. Minimal boilerplate—just add use Sofa\Revisionable\RevisionableTrait and configure the revisionable() method.revisions table with foreign keys to the original model. Migration is handled via the package’s publisher or manual SQL.revisionable() method’s guard parameter.created_at, user_id).config/app.php vs. config/services.php, namespace changes). Mitigation: Fork or patch the package, or use a compatible alternative like spatie/laravel-activitylog.Revisionable trait may be necessary for unit tests.price")? If so, custom scopes or views may be needed.spatie/laravel-activitylog or laravel-auditing for broader feature sets (e.g., nested models, event hooks)?tymon/jwt-auth), or Sentry/Sentinel. Custom auth systems require extending the revisionable() method.phpunit, pest). May need custom assertions for revision-related logic.revisions table migration.composer require sofa/revisionable
php artisan vendor:publish --provider="Sofa\Revisionable\Laravel\ServiceProvider"
config/sofa_revisionable.php for customizations (e.g., revision_table_name, guard).use Sofa\Revisionable\RevisionableTrait;
class Post extends Model {
use RevisionableTrait;
public function revisionable()
{
return true; // or customize guard/table
}
}
revisions table.create()/update().PackageServiceProvider).config/sofa_revisionable.php vs. config/revisionable.php).Illuminate\Support\Facades\Config).laravel-debugbar).revisionable() method.User, Product)./posts/{id}/revisions).revisions table (e.g., model_id, created_at).revisionable() method should be tested during deployments.spatie/laravel-activitylog).How can I help you explore Laravel packages today?