balismatz/filament-prevent-outdated-record-update

Filament package to prevent the update of outdated records.
12,762 9
Install
composer require balismatz/filament-prevent-outdated-record-update
Latest Version:v5.0.1
PHP:^8.2
Laravel:11 · 12 · 13
License:MIT
Last Updated:Jul 12, 2026
Links: GitHub  ·  Packagist
Maintainer: balismatz

Filament Prevent Outdated Record Update

A Filament plugin that prevents users from updating outdated records.

When an outdated record is detected, the update process is stopped and a notification is shown to the user.

A record is considered outdated when it has been modified more recently by another user or when its changes have already been saved. This check is performed based on the updated_at attribute.

Requirements

  • PHP 8.2 or higher
  • Laravel 11.28 or higher
  • Filament 5

Installation

Require the package using Composer:

composer require 'balismatz/filament-prevent-outdated-record-update:^5.0'

Translate the notification

Currently, the notification text is available in English (en) and Greek (el).

If you want to add your own translations or customize the existing ones, publish the language files:

php artisan vendor:publish --provider="BalisMatz\FilamentPreventOutdatedRecordUpdate\FilamentPreventOutdatedRecordUpdateServiceProvider"

Pull requests for additional language translations are welcome.

Usage

Edit action

To prevent outdated record updates on edit action, call the preventOutdatedRecordUpdate() method.

EditAction::make()
    ->label('Edit record')
    ->preventOutdatedRecordUpdate()

The package uses the beforeFormValidated() action hook. If you are also using this hook, you must call it before the preventOutdatedRecordUpdate() method.

EditAction::make()
    ->label('Edit record')
    ->beforeFormValidated(function () {
        // ...
    })
    ->preventOutdatedRecordUpdate()

To prevent outdated record updates globally, call the preventOutdatedRecordUpdate() method from EditAction::configureUsing() in a service provider's boot() method. If you want to allow outdated record updates for a specific edit action, call allowOutdatedRecordUpdate().

EditAction::make()
    ->label('Edit record')
    ->allowOutdatedRecordUpdate()

If you are using the beforeFormValidated() action hook, you must call it after the allowOutdatedRecordUpdate() method.

EditAction::make()
    ->label('Edit record')
    ->allowOutdatedRecordUpdate()
    ->beforeFormValidated(function () {
        // ...
    })

Edit record (page)

To prevent outdated record updates on the edit record (page), use the PreventsOutdatedRecordUpdate trait.

<?php

namespace App\Filament\Resources\Posts\Pages;

use BalisMatz\FilamentPreventOutdatedRecordUpdate\Concerns\PreventsOutdatedRecordUpdate;
use Filament\Resources\Pages\EditRecord;

class EditPost extends EditRecord
{
    use PreventsOutdatedRecordUpdate;

    // ...
}

The package uses the beforeSave() hook. If you are also using this hook, you can use the PreventsOutdatedRecordUpdate trait, as shown in the following example:

<?php

namespace App\Filament\Resources\Posts\Pages;

use BalisMatz\FilamentPreventOutdatedRecordUpdate\Concerns\PreventsOutdatedRecordUpdate;
use Filament\Resources\Pages\EditRecord;

class EditPost extends EditRecord
{
    use PreventsOutdatedRecordUpdate {
        beforeSave as preventsOutdatedRecordUpdateBeforeSave;
    }

    // ...

    protected function beforeSave(): void
    {
        // ...

        $this->preventsOutdatedRecordUpdateBeforeSave();

        // ...
    }

    // ...
}

License

Filament Prevent Outdated Record Update is open-sourced software licensed under the MIT license.

Related Packages

nben/filament-record-nav

Next/Previous record navigation for Filament PHP

25,886 16
pxlrbt/filament-excel

Supercharged Excel exports for Filament Resources

3,215,197 460
bezhansalleh/filament-shield

Filament support for `spatie/laravel-permission`.

5,758,855 2,829
ravaelles/filterable

Package for handling record filtering in Laravel 5.*

406 4

Version History

Version Released PHP License
v5.0.1 ^8.2 MIT
v5.0.0 ^8.2 MIT
v4.0.2 ^8.2 MIT
v4.0.1 ^8.2 MIT
v4.0.0 ^8.2 MIT