Laravel Revert Model Events: Log, list and undo changes done on model objects

Recommend this page to a friend!
  Info   Documentation   View files (27)   Download .zip   Reputation   Support forum   Blog    
Last Updated Ratings Unique User Downloads Download Rankings
2019-11-30 (8 months ago) Not yet rated by the usersTotal: 28 All time: 9,951 This week: 370
Version License PHP version Categories
laravel-revert-model 1.0The PHP License5PHP 5, Databases, Libraries, Logging
Description Author

This package can be used to log, list and undo changes done on model objects.

It provides a service that can be registered to log events regarding changed performed on model objects of applications based on the Laravel framework.

The package can also provide access to let applications show the log of events, as well revert the changes done on the logged model objects.

Innovation Award
PHP Programming Innovation award nominee
November 2019
Number 3
Many applications use databases to store data of the objects that they need to manipulate.

Sometimes it would be good if it was possible to revert certain types of changes done to objects.

This package implements a solution that uses logging of model objects used in Laravel framework based applications to determine how to undo previously executed changes done to those model objects.

Manuel Lemos
Picture of Zacchaeus Bolaji
  Performance   Level  
Name: Zacchaeus Bolaji <contact>
Classes: 13 packages by
Country: Nigeria Nigeria
Age: ???
All time rank: 302016 in Nigeria Nigeria
Week rank: 771 15 in Nigeria Nigeria
Innovation award
Innovation award
Nominee: 8x


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
File Role Description
.circleci (1 file)
src (1 file, 8 directories)
tests (5 files, 1 directory)
.scrutinizer.yml Data Auxiliary data
.styleci.yml Data Auxiliary data
composer.json Data Auxiliary data
phpunit.xml Data Auxiliary data Doc. Documentation

  Files  /  .circleci  
File Role Description
   config.yml Data Auxiliary data

  Files  /  src  
File Role Description
config (1 file)
Console (1 directory)
database (1 directory)
Helpers (1 file)
Http (3 directories)
Models (1 file)
resources (2 directories)
routes (1 file)
   EventRevertServiceProvider.php Class Class source

  Files  /  src  /  config  
File Role Description
   model-event-logger.php Aux. Auxiliary script

  Files  /  src  /  Console  
File Role Description
Commands (1 file)

  Files  /  src  /  Console  /  Commands  
File Role Description
   RevertModelEvent.php Class Class source

  Files  /  src  /  database  
File Role Description
migrations (1 file)

  Files  /  src  /  database  /  migrations  
File Role Description
   2019_10_04_235130_...odel_logs_table.php Class Class source

  Files  /  src  /  Helpers  
File Role Description
   helpers.php Example Example script

  Files  /  src  /  Http  
File Role Description
Controllers (1 file)
Middlewares (1 file)
Traits (1 file)

  Files  /  src  /  Http  /  Controllers  
File Role Description
   ModelLogController.php Class Class source

  Files  /  src  /  Http  /  Middlewares  
File Role Description
   ModelEventLogMiddleware.php Class Class source

  Files  /  src  /  Http  /  Traits  
File Role Description
   ModelEventLogger.php Class Class source

  Files  /  src  /  Models  
File Role Description
   ModelLog.php Class Class source

  Files  /  src  /  resources  
File Role Description
lang (1 directory)
views (3 files)

  Files  /  src  /  resources  /  lang  
File Role Description
en (1 file)

  Files  /  src  /  resources  /  lang  /  en  
File Role Description
   model-event-logger.php Aux. Auxiliary script

  Files  /  src  /  resources  /  views  
File Role Description
   app.blade.php Aux. Auxiliary script
   log-table.blade.php Example Example script
   response.blade.php Aux. Auxiliary script

  Files  /  src  /  routes  
File Role Description
   web.php Aux. Auxiliary script

  Files  /  tests  
File Role Description
models (2 files)
   ModelEventCommandHelperTest.php Class Class source
   ModelEventLogRevertClass.php Class Class source
   ModelEventLogRouteTest.php Class Class source
   ModelEventTest.php Class Class source
   TestCase.php Class Class source

  Files  /  tests  /  models  
File Role Description
   ModelEventLogTestUser.php Class Class source
   TestModel.php Class Class source

 Version Control Unique User Downloads Download Rankings  
This week:0
All time:9,951
This week:370

For more information send a message to info at phpclasses dot org.