PHPackages                             balismatz/filament-prevent-outdated-record-update - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. balismatz/filament-prevent-outdated-record-update

ActiveLibrary

balismatz/filament-prevent-outdated-record-update
=================================================

Filament package to prevent the update of outdated records.

v5.0.1(2mo ago)82.7k↑15.2%2MITPHPPHP ^8.2

Since Dec 1Pushed 2mo agoCompare

[ Source](https://github.com/balismatz/filament-prevent-outdated-record-update)[ Packagist](https://packagist.org/packages/balismatz/filament-prevent-outdated-record-update)[ RSS](/packages/balismatz-filament-prevent-outdated-record-update/feed)WikiDiscussions 5.x Synced 1mo ago

READMEChangelog (5)Dependencies (10)Versions (7)Used By (0)

Filament Prevent Outdated Record Update
=======================================

[](#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
------------

[](#requirements)

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

Installation
------------

[](#installation)

Require the package using Composer:

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

### Translate the notification

[](#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
-----

[](#usage)

### Edit action

[](#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()
```

### Edit record (page)

[](#edit-record-page)

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

```
