Download the PHP package roketin/laravel-auditing without Composer
On this page you can find all versions of the php package roketin/laravel-auditing. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Informations about the package laravel-auditing
Laravel Auditing allows you to record changes to an Eloquent model's set of data by simply adding its trait to your model. Laravel Auditing also provides a simple interface for retreiving an audit trail for a piece of data and allows for a great deal of customization in how that data is provided.
Auditing is based on the package auditing
Installation
Laravel Auditing can be installed with Composer, more details about this package in Composer can be found here.
Run the following command to get the latest version package:
Open the file and then add the service provider, this step is required.
Note: This provider is important for the publication of configuration files.
Only after complete the step before, use the following command to publish configuration settings:
Finally, execute the migration to create the table in your database. This table is used to save audit the logs.
Docs
- Implementation
- Configuration
- Getting the Logs
- Customizing log message
- Examples
- Contributing
- Having problems?
- license
Implementation
Implementation using
To register the change log, use the trait OwnerIt\Auditing\AuditingTrait
in the model you want to audit
Base implementation Legacy Class
It is also possible to have your model extend the OwnerIt\Auditing\Auditing
class to enable auditing. Example:
Configuration
Auditing behavior settings
The Auditing behavior settings are carried out with the declaration of attributes in the model. See the examples below:
- Turn off logging after a number of logs:
$historyLimit = 500
- Disable / enable logging:
$auditEnabled = false
- Turn off logging for specific fields:
$dontKeepLogOf = ['field1', 'field2']
Auditing settings
Using the configuration file, you can define:
- The Model used to represent the current user of application.
- A different database connection for audit.
- The table name used for log registers.
The configuration file can be found at config/auditing.php
Getting the Logs
Getting logs with user responsible for the change.
or
Note: Remember to properly define the user model in the file
Customizing log message
You can define your own log messages for presentation. These messages can be defined for both the model as well as for each one of fields.The dynamic part of the message can be done by targeted fields per dot segmented as{object.property.property} or {object.property|Default value} or {object.property||callbackMethod}
.
Note: This implementation is optional, you can make these customizations where desired.
Set messages to the model
Getting change logs
Featuring log records:
Result:
- Antério Vieira created a team 1 day ago
- The name was defined as gestao
- No one was defined as owner
- Rafael França deleted a team 2 day ago
- No details
- ...
Examples
Spark Auditing
For convenience we decided to use the spark for this example, the demonstration of auditing is simple and self explanatory. Click here and see for yourself.
Dreams
Dreams is a developed api to serve as an example or direction for developers using laravel-auditing. You can access the application here. The back-end (api) was developed in laravel 5.1 and the front-end (app) in angularjs, the detail are these:
Contributing
Contributions are welcomed; to keep things organized, all bugs and requests should be opened on github issues tab for the main project in the roketin/laravel-auditing/issues.
All pull requests should be made to the branch Develop, so they can be tested before being merged into the master branch.
Having problems?
If you are having problems with the use of this package, there is likely someone has faced the same problem. You can find common answers to their problems:
License
The laravel-audit package is open source software licensed under the license MIT