| Package Data | |
|---|---|
| Maintainer Username: | g0110280 |
| Package Create Date: | 2015-11-02 |
| Package Last Update: | 2018-03-26 |
| Language: | PHP |
| License: | MIT |
| Last Refreshed: | 2025-10-27 03:14:37 |
| Package Statistics | |
|---|---|
| Total Downloads: | 1,276 |
| Monthly Downloads: | 0 |
| Daily Downloads: | 0 |
| Total Stars: | 4 |
| Total Watchers: | 6 |
| Total Forks: | 1 |
| Total Open Issues: | 0 |
In /config/app.php, add the following to providers:
Unisharp\AuditTrail\AuditServiceProvider::class,
and the following to aliases:
'Audit' => Unisharp\AuditTrail\Facades\Audit::class,
Run php artisan vendor:publish.
Run php artisan migrate.
All your logs will be recorded in 'audit_trails' table.
You need to add a trait to the model you're going to audit.
class User extends Eloquent
{
use \Unisharp\AuditTrail\Auditable;
protected $table = 'users';
protected $hidden = ['password'];
protected $fillable = ['username', 'email', 'password'];
}
In any place you want to audit your user logs
$User->log($action, $comment = null, $subject = null, $subject_id = null)
Audit::log($action, $comment = null)
$User->log('log in', 'the action is approved')
Audit::log('log in', 'the action is approved')
subject and subject_id parameters.Other usages
You can get your model logs by:
$User->getLogs();
Get all the logs by single user by using:
Audit::getByUserId($user_id)
As time grows, logs would be outdated. You may clean them by:
$User->cleanLogs()
This package is licensed under MIT license.