Log all model events and revert specific model event

1.0.0 2019-11-23 22:29 UTC

This package is auto-updated.

Last update: 2023-09-25 21:37:10 UTC


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

  • Runphp 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