- How do I enable record locking on a Filament resource in 3 steps?
- Add the `HasResourceLocks` trait to your model, include `InteractsWithResourceLock` in your `EditRecord` page, and add the `ResourceLockColumn` to your table. The package handles the rest, including UI integration and lock management.
- Does this package work with Filament v5 and Laravel 12/13?
- Yes, it’s explicitly built for Filament v5 and supports Laravel 12 and 13. The package leverages Filament’s native patterns, so no breaking changes are introduced in these versions.
- What’s the difference between heartbeat and broadcast modes?
- Heartbeat mode uses Livewire’s polling (default ~10s refresh) for lock checks, requiring no extra setup. Broadcast mode uses Laravel Echo for real-time updates, reducing latency but requiring Redis/Reverb and Echo configuration.
- Can I use locking without audit history?
- Absolutely. The package decouples locking logic from audit history. You can enable locking alone by skipping the audit migrations and configuration, saving database space and reducing overhead.
- How does audit history handle custom Filament fields?
- Audit diffs rely on Filament’s built-in field types. For custom fields, implement the `HasAuditDiffPreview` interface to define how changes should render in the audit history. This requires manual setup but ensures consistency.
- What happens if two users open the same record in separate tabs?
- The package handles concurrent locks via Livewire’s reactivity and signed routes. If User A locks a record and User B opens it in another tab, User B will see the lock UI and be blocked from editing until User A releases it.
- Do I need Redis for broadcast mode, or can I use database locks?
- Broadcast mode requires Redis or another queue driver (e.g., Reverb) for Laravel Echo. Database locks are used internally for fallback, but real-time updates depend on the queue system. Heartbeat mode avoids this dependency entirely.
- How do I configure the audit history retention period?
- Set `max_entries_per_resource` in the config file to limit how many audit snapshots are stored per model. The package includes pruning logic to automatically clean up old entries beyond this limit.
- Is there a way to request an unlock if I’m blocked from editing?
- Yes, the package includes an optional ‘ask to unblock’ feature. Enable it in the config, and users will see a button to request the lock owner release the record. The owner can then choose to unlock or ignore the request.
- What are the risks of using broadcast mode in production?
- Broadcast mode depends on Laravel Echo and a queue driver, which adds complexity. Risks include potential latency spikes if the queue is overloaded or misconfigured, and increased infrastructure costs for high-traffic apps. Test thoroughly with your queue setup before deployment.