smartbooster/core-bundle
SmartBooster Core Bundle is a Laravel/PHP package offering shared core services, configuration, and integration utilities for SmartBooster applications, helping developers bootstrap features consistently and reduce boilerplate across projects.
php artisan vendor:publish --tag=...) and run php artisan migrate before touching any entity.resetOnArchive() on the model before wiring archiving into real workflows.Trait-based tracking. Apply the package trait per model; keep the tracked field set explicit rather than "everything" so history stays small and readable.
Archive lifecycle hook. Archiving an entity now triggers an automatic history reset. Treat archive as a lifecycle boundary: whatever you want preserved for compliance must be copied out (or the reset disabled) before the archive call.
Per-entity opt-out. Override resetOnArchive on the entity to return false where archiving is a soft-hide rather than a disposal. This is the intended extension point, so keep the logic declarative:
public function resetOnArchive(): bool
{
return $this->should_purge_history ?? true;
}
Conditional resets. If only some archives should purge history, encode the decision in the override (a model attribute, an enum on the entity, a config flag) instead of branching at every call site — the archive call stays uniform and the policy lives with the entity.
Bulk archives. Archiving in loops or batches now fans out into history deletes. Wrap batch operations in a transaction, chunk large sets, and consider a queued job per entity so a failed reset doesn't abort the whole batch.
Service-layer archiving. Keep archive() calls behind a small action/service class so you can add logging, authorization, and post-archive side effects in one place rather than scattering them across controllers.
Testing. In feature tests, assert both the entity state and history count around archive(). Use RefreshDatabase and disable events when seeding, otherwise seed-time archives will silently reset fixtures' history.
Restore semantics. Decide up front whether "unarchive" should re-create history from scratch; the reset is one-way, so any restore path that expects the old trail needs its own reconstruction logic.
resetOnArchive, your override may never run — check with class_uses and a quick dd() in the method.php artisan config:cache after config changes, and ensure migrations are applied before the first archive in a fresh environment (seeders included).resetOnArchive override and around the archive call to confirm which branch ran; the reset itself is quiet, so without logging a "missing history" bug looks like a tracking failure.resetOnArchive is a plain method override, keep it side-effect free and cheap — it may be evaluated per entity during batch archives.How can I help you explore Laravel packages today?