PHP Classes

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

Recommend this page to a friend!
  Info   Documentation   View files Files   Install with Composer Install with Composer   Download Download   Reputation   Support forum   Blog    
Ratings Unique User Downloads Download Rankings
Not yet rated by the usersTotal: 31 All time: 11,135 This week: 455Up
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  
Innovation award
Innovation award
Nominee: 12x

Winner: 1x

 

Documentation

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.

Installation

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' => [
    // ...
    Djunehor\EventRevert\EventRevertServiceProvider::class,
];

Lumen

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

// Register Service Providers
    // ...
    $app->register(Djunehor\EventRevert\EventRevertServiceProvider::class);
];

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.

Usage

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

Contributing

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

  Files folder image Files (27)  
File Role Description
Files folder image.circleci (1 file)
Files folder imagesrc (1 file, 8 directories)
Files folder imagetests (5 files, 1 directory)
Accessible without login Plain text file .scrutinizer.yml Data Auxiliary data
Accessible without login Plain text file .styleci.yml Data Auxiliary data
Accessible without login Plain text file composer.json Data Auxiliary data
Accessible without login Plain text file phpunit.xml Data Auxiliary data
Accessible without login Plain text file README.md Doc. Documentation

The PHP Classes site has supported package installation using the Composer tool since 2013, as you may verify by reading this instructions page.
Install with Composer Install with Composer
 Version Control Unique User Downloads Download Rankings  
 100%
Total:31
This week:0
All time:11,135
This week:455Up