balismatz/filament-prevent-outdated-record-update
EditAction), leveraging its hooks (beforeFormValidated) and UI components (notifications). This ensures seamless integration with Filament’s existing workflows without disrupting core functionality.timestamps + lock_for_updates), but with a user-facing notification instead of a database-level conflict. Useful for UX-focused applications where explicit feedback is preferred over silent failures.updated_at timestamps, which is simple but may not cover all edge cases (e.g., clock skew, manual timestamp overrides). For high-concurrency systems, consider supplementing with database-level locks or versioning.preventOutdatedRecordUpdate()) on EditAction. No need to modify models, controllers, or routes.beforeFormValidated() is already used in the same action. Requires explicit sequencing (hook must be called before the package’s method).updated_at lag). Mitigate by combining with client-side timestamps or database transactions.updated_at could bypass the check. Document this risk and enforce timestamp integrity in CI/CD.updated_at on every edit. Negligible for most apps, but could be a bottleneck in high-frequency update scenarios (e.g., real-time dashboards).lock_for_updates() for critical operations?updated_at timestamps trusted, or could they be tampered with? If so, add server-side validation.updated_at timestamps to verify edge cases.$model->timestamps = false; $model->freshTimestamp();).updated_at timestamps; no schema changes required.updated_at is enabled on target models ($table->timestamps()).composer require balismatz/filament-prevent-outdated-record-update:^5.0.php artisan vendor:publish --provider="BalisMatz\...".EditAction:
EditAction::make()
->preventOutdatedRecordUpdate()
->beforeFormValidated(fn () => { /* other hooks */ });
use BalisMatz\FilamentPreventOutdatedRecordUpdate\ChecksOutdatedRecord;
$checker = new ChecksOutdatedRecord($record);
if ($checker->isOutdated()) {
return back()->with('error', $checker->getMessage());
}
refreshModelAndFail() or manual timestamp manipulation.beforeFormValidated(). Document hook ordering in the codebase.Action classes. For custom logic, extract the checker class (ChecksOutdatedRecord) and use it manually.preventOutdatedRecordUpdate() after beforeFormValidated() if both are used.updated_at is updated within the same transaction to avoid race conditions.updated_at changes.updated_at comparison) is sealed; extensions require forking or PRs.spatie/laravel-filament-outdated-record).updated_at values during conflicts to diagnose false positives.forceUpdate() method) if needed.updated_at. For high-volume apps, consider:
updated_at in Redis (invalidate on updates).| Failure Scenario | Impact | Mitigation |
|---|---|---|
updated_at timestamp tampered |
False negatives (updates allowed) | Validate timestamps in CI/CD; use database locks for critical data. |
| Network latency between servers | Stale updated_at reads |
Use Redis for distributed timestamp caching. |
| Multiple concurrent edits | User frustration, lost work | Combine with client-side timestamps or optimistic UI (e.g., "Saving..." spinners). |
| Package incompatibility with Filament updates | Breaks functionality | Test against Filament’s beta releases; fork if needed. |
| Missing translations | Poor UX for non-English users | Publish custom language files or contribute upstream. |
beforeFormValidated vs. preventOutdatedRecordUpdate).How can I help you explore Laravel packages today?