androsamp/filament-resource-lock
EditRecord pages, leveraging Livewire’s reactivity model. The package extends Filament’s existing concerns (InteractsWithResourceLock, HasResourceLocks) without requiring architectural overhauls.wire:navigate), with broadcast mode using Laravel Echo for near-instant updates. Avoids full-page reloads, critical for modern admin UIs.broadcast driver, requires:
window.Echo configuration.resource_locks, resource_lock_audits) via migrations. Schema is opinionated but extensible (e.g., custom user_display_column).heartbeat mode.| Risk Area | Severity | Mitigation |
|---|---|---|
| Broadcast Latency | Medium | Fallback to heartbeat in config if Echo misconfigures. Monitor release_grace_seconds. |
| Audit Overhead | Low | Configurable max_entries_per_resource limits bloat. Indexes on lock_cycle_id recommended. |
| Lock Contention | Medium | Tune ttl_seconds (default: 20s) based on user session behavior. |
| Custom Field Diffs | High | Requires manual implementation of HasAuditDiffPreview for non-supported fields. |
| Save() Override Pitfalls | High | Explicit warnings in docs; risk of broken audits if save() is overridden without calling trait methods. |
| Redis Dependency | Medium | Storage driver is optional; default is database. |
| Filament Version Lock | Critical | Hard dependency on Filament v5. Downgrade path unclear for v4/v3. |
save_and_unlock) be automatic or manual (requires permission)?broadcast mode justified (Echo setup cost) or is heartbeat (polling) acceptable?HasAuditDiffPreview?EditRecord pages. No panel/plugin registration needed.private channels.| Step | Action | Risk |
|---|---|---|
| 1. Prep Environment | Ensure Laravel 12/13 + Filament v5. Update composer.json for PHP 8.3. |
Breaking changes if downgrading. |
| 2. Install Package | composer require androsamp/filament-resource-lock + php artisan install. |
Migration conflicts if custom tables exist. |
| 3. Configure | Update config/filament-resource-lock.php (driver, TTL, permissions). |
Misconfig may cause lock storms. |
| 4. Enable Locks | Add traits to models/pages (HasResourceLocks, InteractsWithResourceLock). |
Forgetting to add to all resources. |
| 5. Test Heartbeat | Verify locks work in heartbeat mode (no Echo setup). |
Latency may feel sluggish. |
| 6. Optional: Broadcast | Configure Echo + set update_driver: broadcast. |
Echo misconfig breaks locks. |
| 7. Enable Audit | Add HasResourceAudit to pages + override save() if needed. |
Audit breaks if save() is overridden. |
| 8. UI Polish | Customize lock column, notifications, or diff previews. | Styling may need CSS overrides. |
HasResourceLocks trait on models.HasAuditDiffPreview for unsupported fields.filament-resource-lock.* logs for lock timeouts or stale releases.resource_locks table for orphaned locks (e.g., updated_at > now() - interval 1 hour).stale_soft_release_ignore_seconds or ttl_seconds.save() calls syncResourceAuditBeforeSave()/AfterSave().APP_URL for signed routes.save_and_unlock vs. ask_to_unblock).DB::table('resource_locks')->where(...)->delete()).SELECT FOR UPDATE contention under high load. Consider Redis.audit.max_entries_per_resource.lock_cycle_id and created_at for large audit tables.| Failure Scenario | Impact | Mitigation |
|---|---|---|
| **Echo Outage (Broadcast |
How can I help you explore Laravel packages today?