Download the PHP package lukasjankowski/laravel-revision without Composer
On this page you can find all versions of the php package lukasjankowski/laravel-revision. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download lukasjankowski/laravel-revision
More information about lukasjankowski/laravel-revision
Files in lukasjankowski/laravel-revision
Package laravel-revision
Short Description A laravel 5 revision package for watching changes with multi guard support
License MIT
Informations about the package laravel-revision
Unmaintained
Laravel-Revision for Larvel 5
This package allows you to log changes made to specific models.
Note: There are many packages, which cover similar aspects. This package was heavily inspired by Revisionable and Laravel-Auditing you should definitely check them out.
Why another?
Simple: Both these packages do not - at the time of writing - multi-auth support. This one does.
I ran into a problem while working on a project, namely that I wanted to use said packages and got stuck as soon as I realized that they do not support different Auth-Providers. So I went ahead and made this package. It follows the same basic principle and uses a very similar syntax.
Installation
Require via composer:
Include the service provider within your .
Publish the config file.
Publish the migration.
You can change the table name within the config file, which will be located at: .
Finally migrate the migration:
Usage
Add the trait to the models, which you want to enable revisions on.
Example:
Add the trait to the models, which you want to be the ones perfoming the revisions.
Example:
You can perform the configuration in the generalized file. But if you want to perform more fine grained control:
``
Revisions will log the , , and event.
You can then access these revisions:
From the model, which "hasRevisions": `` From the model, which "hasRevisions" with eager-loading:
From the model, which "isReviser", which performed the revision:
From the model, which "isReviser", which performed the revision with eager-loading:
Since it's a collection it supports all its methods:
But also a way to get the modified data:
As you can see it is very similar to the above mentioned packages. However it doesn't matter, who performs the revision as long as they implement the IsReviser trait. The package will then go ahead and try to fetch the currently logged in user as the reviser, if that fails it will default to null.
TODO
- Unit tests