codefun/activitylog
最新稳定版本:v1.0.7
Composer 安装命令:
composer require codefun/activitylog
包简介
Laravel Activity Log
README 文档
README
- This package will automatically Observe your Model class and track every data manupulation history like create, update, delete.
- It will automatically store both record (Previous record and Current Record). Also it can show the diffrences between previous and updated record of Model information along with user record of who manupulated the data.
Installation Process
composer require codefun/activitylogphp artisan migrate- Optionally use:
php artisan vendor:publish --tag=codefun_activity
Before Laravel 5.7
Add the following into your providers array on config\app.php:
CodeFun\Activitylog\App\Providers\ActivityServiceProvider
then add This alias into alias array on config\app.php:
"Activity" => CodeFun\Activitylog\Facade\Activity::class
Not necessary from Laravel 5.7 onwards
Publish Resource File
php artisan vendor:publish --tag=codefun_activity
By default codefun provides a basic blade file with bootstrap(v5) for viewing Activity Log and Log Details.
You can to customize this blade page design by publishing the blade file.
It can be located at resources/views/vendor/codefun/
How To Use?
Go to your Model and use the trait file:
use CodeFun\Activitylog\App\Component\Traits\ModelActivity;
class AnyModel extends Model
{
use ModelActivity;
}
If you want to set custom message while data manipulation, override this method inside your model as shown:
use CodeFun\Activitylog\App\Component\Traits\ModelActivity;
class AnyModel extends Model
{
use ModelActivity;
public function getDescriptionForEvent($event_name) : string{
return "Information has been ". $event_name;
}
}
How to Show Activity log Via Web Route and API Route
For API
- http:://base_url/api/activity-log/list
- http:://base_url/api/activity-log/view/{uuid}
For Web
- http:://base_url/activity-log
统计信息
- 总下载量: 48
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 1
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2023-08-23