- How do I enable approvals for a Laravel Eloquent model with minimal setup?
- Use the `RequiresApproval` trait on your model. This auto-intercepts create/update/delete operations and enforces approvals based on your configured rules. No manual middleware or observers needed—just add the trait and define approval requirements in the config.
- Can I require approvals from multiple roles (e.g., 2 admins + 1 manager) for a single action?
- Yes. The package supports multi-role approvals out of the box. Configure the required roles in the `approval_requirements` array for your model, and Maker-Checker will enforce all specified roles before allowing the action to proceed.
- What Laravel versions does this package support, and are there breaking changes between them?
- Maker-Checker is tested on Laravel 10.x and 11.x (LTS releases). The package follows Laravel’s semantic versioning, so minor updates align with Laravel’s release cycles. Always check the `composer.json` constraints for exact version requirements.
- How do conditional rules work (e.g., approving transactions over $50K differently)?
- Conditional rules are defined via closures in your model’s `approval_requirements`. For example, you can specify that transactions over $50K require an additional manager approval. The rules engine evaluates these conditions dynamically at runtime.
- Does Maker-Checker support approval delegation, and how does it handle expiry?
- Yes, delegated approvals are supported with expiry logic. Approvers can delegate their approval to another user, but the delegation has a configurable expiry time. This prevents stale delegations and ensures accountability.
- How does the package handle race conditions when multiple users try to approve the same request?
- Maker-Checker uses pessimistic locking to prevent race conditions. When an approval is submitted, the system locks the request until it’s fully processed, ensuring no duplicate approvals or conflicts. This is critical for high-concurrency environments.
- Can I integrate Maker-Checker with an existing Laravel permission system (e.g., Spatie Permissions)?
- Yes, but you’ll need to implement the `MakerCheckerUserContract` to align with your existing RBAC. The contract bridges Maker-Checker’s approval logic with your user/role system. Ensure your `User` model fulfills the contract’s requirements for roles and permissions.
- What if I need to bypass approvals for certain actions (e.g., admin overrides)?
- Use the `withoutApprovalDo()` method or configure bypass rules in your model. For example, admins can skip approvals for specific actions by defining exceptions in the `approval_requirements` array or via middleware.
- How do I export approval audit trails for compliance reporting?
- Maker-Checker includes built-in audit trail exports in CSV or JSON format. Use the `/api/approvals/audit` endpoint or manually query the `approval_audit_logs` table. Customize the export format by extending the `AuditExporter` class.
- Are there alternatives to Maker-Checker for simpler approval workflows, and when should I use them?
- For basic approvals (e.g., single-role checks), lighter packages like `spatie/laravel-activitylog` or custom middleware may suffice. Use Maker-Checker only if you need multi-role approvals, conditional rules, delegation, or bulk operations—features rare in simpler packages.