PHPackages                             it-devgroup/laravel-model-change-log - 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. [Utility &amp; Helpers](/categories/utility)
4. /
5. it-devgroup/laravel-model-change-log

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

it-devgroup/laravel-model-change-log
====================================

laravel model change log

1.0.0(3y ago)04MITPHPPHP ^8.0

Since Aug 24Pushed 3y ago1 watchersCompare

[ Source](https://github.com/gavoronok30/laravel-model-change-log)[ Packagist](https://packagist.org/packages/it-devgroup/laravel-model-change-log)[ RSS](/packages/it-devgroup-laravel-model-change-log/feed)WikiDiscussions 1.x Synced yesterday

READMEChangelog (1)Dependencies (3)Versions (2)Used By (0)

Description
-----------

[](#description)

- customizable automatic logging of any eloquent models
- rollback or apply any past changes through history
- it is possible to disable logging for a separate piece of code
- it is possible to enable or disable individual module events for a separate piece of code
- command to clean up old entries, can be applied in cron

Install for laravel
-------------------

[](#install-for-laravel)

**1.** Open file **config/app.php** and search

```
    'providers' => [
        ...
    ]

```

Add to section

```
        \ItDevgroup\ModelChangeLog\Providers\ModelChangeLogProvider::class,

```

Example

```
    'providers' => [
        ...
        \ItDevgroup\ModelChangeLog\Providers\ModelChangeLogProvider::class,
    ]

```

Attention! It is recommended to connect the service provider in the list last

**2.** Run commands

For creating config file

```
php artisan vendor:publish --provider="ItDevgroup\ModelChangeLog\Providers\ModelChangeLogProvider" --tag=config

```

For creating migration file

```
php artisan model:change:log:publish --tag=migration

```

For generate table

```
php artisan migrate

```

**3.** Open config file `config/model_change_log.php` and customize

Command for clear old entries
-----------------------------

[](#command-for-clear-old-entries)

```
php artisan model:change:log:clear

```

or run in laravel scheduler in the file `app/Console/Kernel.php`

```
protected function schedule(Schedule $schedule)
{
    ...
    $schedule->command('model:change:log:clear')->daily();
    ...
}

```

Usage
-----

[](#usage)

#### Enable/Disable module for current script

[](#enabledisable-module-for-current-script)

```
ModelChangeLogFacade::logEnabled(
    false
);

```

#### Enable/Disable event for current script

[](#enabledisable-event-for-current-script)

```
\ItDevgroup\ModelChangeLog\Facades\ModelChangeLogFacade::eventEnabled(
    \ItDevgroup\ModelChangeLog\Models\ModelChangeLog::TYPE_EVENT_UPDATE,
    false
);

```

#### Events:

[](#events)

- \\ItDevgroup\\ModelChangeLog\\Models\\ModelChangeLog::TYPE\_EVENT\_CREATE
- \\ItDevgroup\\ModelChangeLog\\Models\\ModelChangeLog::TYPE\_EVENT\_UPDATE
- \\ItDevgroup\\ModelChangeLog\\Models\\ModelChangeLog::TYPE\_EVENT\_DELETE
- \\ItDevgroup\\ModelChangeLog\\Models\\ModelChangeLog::TYPE\_EVENT\_SOFT\_DELETE
- \\ItDevgroup\\ModelChangeLog\\Models\\ModelChangeLog::TYPE\_EVENT\_FORCE\_DELETE

#### Apply changes from history

[](#apply-changes-from-history)

```
/**
\ItDevgroup\ModelChangeLog\Facades\ModelChangeLogFacade::applyChanges(
    ModelChangeLog $model,
    array $fields = []
);
*/
\ItDevgroup\ModelChangeLog\Facades\ModelChangeLogFacade::applyChanges($model);
\ItDevgroup\ModelChangeLog\Facades\ModelChangeLogFacade::applyChanges($model, ['first_name', 'last_name']);

```

`$fields` - List of fields to be applied, if not specified, all fields from the history will be applied

#### Rollback changes from history

[](#rollback-changes-from-history)

```
/**
\ItDevgroup\ModelChangeLog\Facades\ModelChangeLogFacade::rollbackChanges(
    ModelChangeLog $model,
    array $fields = []
);
*/
\ItDevgroup\ModelChangeLog\Facades\ModelChangeLogFacade::rollbackChanges($model);
\ItDevgroup\ModelChangeLog\Facades\ModelChangeLogFacade::rollbackChanges($model, ['first_name', 'last_name']);

```

`$fields` - List of fields to be applied, if not specified, all fields from the history will be applied

Optional modification custom model
----------------------------------

[](#optional-modification-custom-model)

#### Get entries from history for current model

[](#get-entries-from-history-for-current-model)

If you add trait `\ItDevgroup\ModelChangeLog\Traits\ModelChangeLogTrait`to your eloquent model, then the history of this model will be available by relationship

```
class User extends Model
{
    use \ItDevgroup\ModelChangeLog\Traits\ModelChangeLogTrait;
    ...

```

```
$list = User::query()->find(1)->modelChangeLog;
$list[0]->change_list;
$list[7]->change_list;

```

#### Not logged fields for current model

[](#not-logged-fields-for-current-model)

```
class User extends Model
{
    public $notLogFields = [
        'password',
        'email_verified_at',
    ];
    ...

```

#### Default Field Value for Restoring a Model

[](#default-field-value-for-restoring-a-model)

Fields that will be filled with default values (when the model is restored), recommended for required model fields in case these fields are not in the history

```
class User extends Model
{
    public $restoreDefaultRawValues = [
        'email_verified_at' => '2022-01-24 15:00:00',
        'remember_token' => '12345',
    ];
    ...

```

All other work with the history is done through the eloquent model `\ItDevgroup\ModelChangeLog\Models\ModelChangeLog`

###  Health Score

23

—

LowBetter than 26% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity3

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity52

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% 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.

###  Release Activity

Cadence

Every ~0 days

Total

2

Last Release

1410d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/17120176?v=4)[gavoronok30](/maintainers/gavoronok30)[@gavoronok30](https://github.com/gavoronok30)

---

Top Contributors

[![gavoronok30](https://avatars.githubusercontent.com/u/17120176?v=4)](https://github.com/gavoronok30 "gavoronok30 (1 commits)")

---

Tags

laravelmodellogschange

### Embed Badge

![Health badge](/badges/it-devgroup-laravel-model-change-log/health.svg)

```
[![Health](https://phpackages.com/badges/it-devgroup-laravel-model-change-log/health.svg)](https://phpackages.com/packages/it-devgroup-laravel-model-change-log)
```

###  Alternatives

[psalm/plugin-laravel

Psalm plugin for Laravel

3355.3M346](/packages/psalm-plugin-laravel)[laravel/cashier

Laravel Cashier provides an expressive, fluent interface to Stripe's subscription billing services.

2.6k29.9M147](/packages/laravel-cashier)[laravel/pulse

Laravel Pulse is a real-time application performance monitoring tool and dashboard for your Laravel application.

1.7k15.1M132](/packages/laravel-pulse)[flarum/core

Delightfully simple forum software.

201.4M2.3k](/packages/flarum-core)[api-platform/laravel

API Platform support for Laravel

58171.6k14](/packages/api-platform-laravel)[wearepixel/laravel-cart

A cart implementation for Laravel

1374.8k](/packages/wearepixel-laravel-cart)

PHPackages © 2026

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