cjmellor/approval
Laravel package to stage new model changes for review before they’re persisted. Add approvals to your workflow, store pending records in the database, and promote them once approved. Supports PHP 8.3+ and Laravel 12.4+/13.
illuminate/contracts: ^12.4|^13.0. Users on Laravel 11 should remain on ^2.0 or upgrade their application.#[Scope] attribute, which was introduced in Laravel 12.4.#[Scope] attribute — The requestedBy query scope on Approval has been migrated from the scope* method-name convention to Laravel 12.4's #[Illuminate\Database\Eloquent\Attributes\Scope] attribute. Calling Approval::requestedBy($user) continues to work identically.thenDo() renamed to thenCustom() — The callback parameter was removed (it was silently discarded). Use an ApprovalExpired event listener for custom expiration logic.ModelRolledBackEvent renamed to ModelRolledBack — Consistent naming with all other event classes.Cjmellor\Approval\Facades\Approval has been removed. Use Cjmellor\Approval\Models\Approval directly.config('approval.approval.approval_pivot') is now config('approval.approval_pivot'). Re-publish your config file.$approval property typed as Approval — Previously typed as Illuminate\Database\Eloquent\Model, now typed as Cjmellor\Approval\Models\Approval.pending() scope excludes custom states — If you use configurable states, Approval::pending() now only returns genuinely pending approvals (not those with a custom state set). Use whereState('pending') for the old behaviour.ExpirationAction enum — The expiration_action column is now cast to Cjmellor\Approval\Enums\ExpirationAction.ExpirationAction enum — Type-safe expiration actions (Reject, Postpone, Custom) replacing raw strings.ApprovalEvent base class — All events now extend a shared abstract class with typed Approval $approval and ?Authenticatable $user properties.ApprovalStatus::values() helper — Returns all standard state values as an array.actioned_by tracking — Expired approvals now record who/what processed them.processExpired() resilience — Uses chunkById() for bounded memory, per-approval error handling with report(), and filters to pending-only approvals.approvalModelExists() now filters by approvalable_type and approvalable_id, preventing cross-model false positives.rollback() and approve() — Clear error messages when the related model has been deleted.getState() null safety — Fixed a bug where getState() returned null instead of the standard state value after the v2 migration.callCastAttribute uses getCasts() — Supports both property and method-based cast definitions (Laravel 11+).class_uses_recursive() — Factory trait now detects MustBeApproved on parent classes.json_decode with JSON_THROW_ON_ERROR — Malformed JSON now fails loudly instead of silently becoming null.Schema::hasTable()/Schema::hasColumn() queries.$fillable — Replaced $guarded = [] with an explicit list of mass-assignable columns.down() methods — All newer migrations now include idempotent rollback methods.illuminate/contracts ^11.0|^12.0|^13.0.Full Changelog: https://github.com/cjmellor/approval/compare/v1.6.5...v1.6.6
Full Changelog: https://github.com/cjmellor/approval/compare/v1.6.4...v1.6.5
Full Changelog: https://github.com/cjmellor/approval/compare/v1.6.3...v1.6.4
Full Changelog: https://github.com/cjmellor/approval/compare/v1.6.2...v1.6.3
Full Changelog: https://github.com/cjmellor/approval/compare/v1.6.1...v1.6.2
Full Changelog: https://github.com/cjmellor/approval/compare/v1.6.0...v1.6.1
Full Changelog: https://github.com/cjmellor/approval/compare/v1.5.0...v1.6.0
[!IMPORTANT] This release requires that you're using >= PHP 8.2. If you're not, stick to the previous version.
Full Changelog: https://github.com/cjmellor/approval/compare/v1.4.5...v1.5.0
Full Changelog: https://github.com/cjmellor/approval/compare/v1.4.4...v1.4.5
Full Changelog: https://github.com/cjmellor/approval/compare/v1.4.3...v1.4.4
Full Changelog: https://github.com/cjmellor/approval/compare/v1.4.2...v1.4.3
Full Changelog: https://github.com/cjmellor/approval/compare/v1.4.1...v1.4.2
Full Changelog: https://github.com/cjmellor/approval/compare/v1.4.0...v1.4.1
Full Changelog: https://github.com/cjmellor/approval/compare/v1.3.1...v1.4.0
Full Changelog: https://github.com/cjmellor/approval/compare/v1.3.0...v1.3.1
Full Changelog: https://github.com/cjmellor/approval/compare/v1.2.0...v1.3.0
Full Changelog: https://github.com/cjmellor/approval/compare/v1.1.5...v1.2.0
approvalable_type by @mtawil in https://github.com/cjmellor/approval/pull/31Full Changelog: https://github.com/cjmellor/approval/compare/v1.1.4...v1.1.5
How can I help you explore Laravel packages today?