PHPackages                             rukhsar/modelhistory - 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. rukhsar/modelhistory

ActiveLibrary

rukhsar/modelhistory
====================

Provides tracking of Laravel Models for creating, updating and deleting events

v1.0(9y ago)011MITPHPPHP &gt;=5.4.0

Since Nov 25Pushed 9y ago1 watchersCompare

[ Source](https://github.com/Rukhsar/modelhistory)[ Packagist](https://packagist.org/packages/rukhsar/modelhistory)[ RSS](/packages/rukhsar-modelhistory/feed)WikiDiscussions master Synced 2mo ago

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

Laravel Eloquent Model History
==============================

[](#laravel-eloquent-model-history)

Provides tracking of Laravel Models for creating, updating and deleting events. When a model which use ModelHistory trait call created/updated/deleted, an entry is written to the database with which user updated the model and some information about model changes.

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

[](#installation)

Run the follwoing command

```
composer require rukhsar/modelhistory

```

Next, add the service provider in your array in `config/app.php` :

```
'providers' => [
    ...
            Rukhsar\ModelHistoryServiceProvider::class,
    ...
],
```

Publish the database migration

```
php artisan vendor:publish --provider="Rukhsar\ModelHistoryServiceProvider"

```

and run

```
php artisan migration

```

This will setup a model\_history table in your database.

Use it
------

[](#use-it)

In you model, just add

```
use Rukhsar\Traits\ModelHistory;
```

and within you class defination use it like below

```
