coloredcow/laravel-audit
Composer 安装命令:
composer require coloredcow/laravel-audit
包简介
Audit logging for Laravel
README 文档
README
A package to capture system activity in a Laravel application. Currently supports the following fields:
- IP of HTTP request,
- HTTP referer,
- a description of the action you want to audit.
- user id
- Other details like data and keys
Installation
- Run
composer require coloredcow/laravel-audit - Add the
ColoredCow\LaravelAudit\AuditServiceProvidertoconfig/app.php
'providers' => [
ColoredCow\LaravelAudit\AuditServiceProvider::class
];
- Run
php artisan migrate
Usage
- Use the
ColoredCow\LaravelAudit\Events\Auditabletrait in the events you want to audit. And add this to the contructor of the event.
$this->setAudit([
'ip' => 'ip-of-user-here',
'referer' => 'referer-address',
'action' => 'description of event and action being audited'
]);
- Use the
ColoredCow\LaravelAudit\Listeners\AuditActivitieslistener to listen to the events to want to audit. Map it in the EventServiceProvider of your laravel application.
Audit Facade
- Add AuditFacade in your app to make a audit directly from the applications.
AuditFacade::make(['action' => 'Audit Action']);
- You can also overide other properties like ip, userid and descriptions.
AuditFacade::make(['action' => 'Audit Action', 'ip' => 'My IP']);
统计信息
- 总下载量: 526
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 4
- 点击次数: 2
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: GPL-3.0
- 更新时间: 2017-09-01