PHPackages                             nocturnalsm/pendingupdate - 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. nocturnalsm/pendingupdate

ActiveLibrary

nocturnalsm/pendingupdate
=========================

Laravel Pending Update Trait

00[1 PRs](https://github.com/nocturnalsm/pendingupdate/pulls)PHP

Since Mar 4Pushed 5y ago1 watchersCompare

[ Source](https://github.com/nocturnalsm/pendingupdate)[ Packagist](https://packagist.org/packages/nocturnalsm/pendingupdate)[ RSS](/packages/nocturnalsm-pendingupdate/feed)WikiDiscussions master Synced yesterday

READMEChangelogDependenciesVersions (2)Used By (0)

Laravel Pending Update
======================

[](#laravel-pending-update)

This package can make a model will pertain their original data when it is updated, while the updated fields will be stored to an update model. Later, you can apply the update or cancel the update

Once installed you can do stuff like this:

```
$model = Model::where("name", "Sugiarto");
$model->name = 'Bambang';
$model->pendingUpdate(); // put this after you've made the changes
$model->save();
echo $model->name;
// this won't print 'Bambang', but will still print 'Sugiarto'
// but if you do
$model->usePending();
echo $model->name;
// it will print Bambang;

// then if you want to apply the updated model to the original, you use
$model->applyUpdate();
// or to cancel:
$model->cancelUpdate();
```

Instalation
-----------

[](#instalation)

1. You can install the package with composer. Inside your Laravel project folder, type:

```
composer require nocturnalsm/pendingupdate

```

2. Optional: The service provider will automatically get registered. Or you may manually add the service provider in your `config/app.php` file.

```
'providers' => [
    // ...
    NocturnalSm\PendingUpdate\PendingUpdateServiceProvider::class,
];
```

3. Publish the migration files

```
php artisan vendor:publish --provider="NocturnalSm\PendingUpdate\PendingUpdateServiceProvider" --tag=migrations

```

4. And run the migration

```
php artisan migrate

```

5. Add the PendingUpdate trait to your model

```
use NocturnalSm\PendingUpdate\PendingUpdate;

class Model extends Model
{
    use PendingUpdate;
}
```

Functions
---------

[](#functions)

```
// pending the update
$model->pendingUpdate();

// apply update to the data
$model->applyUpdate();

// cancel the update and return the data to the original
$model->cancelUpdate();

// return pending updates for the model
$model->updates();

// check if the pending data with the specified $key column has change
$model->hasPendingValue($key);

// get the pending value for a column specified with $key
$model->getPendingValue($key);

// make subsequent call to the data values to return the pending value
$model->usePending();

// make subsequent call to the data values to return the original value
$model->useOriginal();
```

Need a UI?
----------

[](#need-a-ui)

The package doesn't come with any UI, you should build that yourself. But you can contact me if you want to implement it.

Contact &amp; Support
---------------------

[](#contact--support)

I'm a web developer from Indonesia. I offer services on web development, especially using Laravel. Please email me at .

License
-------

[](#license)

The MIT License (MIT). Please see [License File](LICENSE.md) for more information.

###  Health Score

16

—

LowBetter than 5% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity0

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity32

Early-stage or recently created project

 Bus Factor1

Top contributor holds 66.7% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

### Community

Maintainers

![](https://www.gravatar.com/avatar/fd2e17d390eea744c53bbb799c2319356ea0c747df9783d6d626011f885ef245?d=identicon)[nocturnalsm](/maintainers/nocturnalsm)

---

Top Contributors

[![nocturnalsm](https://avatars.githubusercontent.com/u/18625560?v=4)](https://github.com/nocturnalsm "nocturnalsm (2 commits)")[![dependabot[bot]](https://avatars.githubusercontent.com/in/29110?v=4)](https://github.com/dependabot[bot] "dependabot[bot] (1 commits)")

### Embed Badge

![Health badge](/badges/nocturnalsm-pendingupdate/health.svg)

```
[![Health](https://phpackages.com/badges/nocturnalsm-pendingupdate/health.svg)](https://phpackages.com/packages/nocturnalsm-pendingupdate)
```

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
