PHP Classes


Recommend this page to a friend!
  Classes of Zacchaeus Bolaji   Laravel Revert Model Events   Download  
Role: Documentation
Content type: text/markdown
Description: Documentation
Class: Laravel Revert Model Events
Log, list and undo changes done on model objects
Author: By
Last change:
Date: 4 years ago
Size: 3,756 bytes


Class file image Download

Laravel Model Event Log & Revert

CircleCI Latest Stable Version Total Downloads License StyleCI Build Status Scrutinizer Code Quality Code Coverage

Laravel Model Event Logger and Revert logs every action on a model (create, delete, update), provides an interface to see the list of all activities as well as revert specific model event.


Step 1

You can install the package via composer:

composer require djunehor/laravel-revert-query

Laravel 5.5 and above

The package will automatically register itself, so you can start using it immediately.

Laravel 5.4 and older

In Laravel version 5.4 and older, you have to add the service provider in config/app.php file manually:

'providers' => [
    // ...


After installing the package, you will have to register it in bootstrap/app.php file manually:

// Register Service Providers
    // ...

Step 2 - Publishing files

  • Run: `php artisan vendor:publish --tag=ModelEventLogger` This will move the migration file, seeder file and config file to your app.
  • Open `config/model-event-logger` to set the model name and ID of users allowed to access to model event log routes
  • the ID can be a number or list of comma-separated numbers e.g `1,2,3,4,5`

Step 3 - SetUp database

  • Run`php artisan migrate` to create the table.


use Djunehor\EventRevert\ModelEventLogger;`
  • Add `use ModelEventLogger` to your laravel model

Access Saved model event logs

|Endpoint|Description| |:------------- | :----------: | |/model-events|return all saved model events| |/model-events/{log}|return all model events of a specific model| |/model-event-revert/{id}|revert specific model event|

Reverting via Console

If you know the specific ID of the event you which you revert, you can run: php artisan model:revert --id=EVENT_ID


  • Fork this project
  • Clone to your repo
  • Make your changes and run tests `composer test`
  • Push and create Pull Request