| Package Data | |
|---|---|
| Maintainer Username: | luoyangpeng |
| Maintainer Contact: | luoyangpeng1122@163.com (luoyangpeng) |
| Package Create Date: | 2016-07-07 |
| Package Last Update: | 2018-01-19 |
| Home Page: | |
| Language: | PHP |
| License: | MIT |
| Last Refreshed: | 2025-11-02 15:01:29 |
| Package Statistics | |
|---|---|
| Total Downloads: | 7,680 |
| Monthly Downloads: | 394 |
| Daily Downloads: | 0 |
| Total Stars: | 57 |
| Total Watchers: | 3 |
| Total Forks: | 14 |
| Total Open Issues: | 2 |
Laravel 5 操作日志自动记录
The ActionLog Service Provider can be installed via Composer by requiring the
luoyangpeng/action-log package and setting the minimum-stability to dev (required for Laravel 5) in your
project's composer.json.
{
"require": {
"luoyangpeng/action-log": "~1.0"
},
}
or
Require this package with composer:
composer require luoyangpeng/action-log
Update your packages with composer update or install with composer install.
To use the ActionLog Service Provider, you must register the provider when bootstrapping your Laravel application. There are essentially two ways to do this.
Find the providers key in config/app.php and register the ActionLog Service Provider.
'providers' => [
// ...
'luoyangpeng\ActionLog\ActionLogServiceProvider',
]
for Laravel 5.1+
'providers' => [
// ...
luoyangpeng\ActionLog\ActionLogServiceProvider::class,
]
Find the aliases key in config/app.php.
'aliases' => [
// ...
'ActionLog' => 'luoyangpeng\ActionLog\Facades\ActionLogFacade',
]
for Laravel 5.1+
'aliases' => [
// ...
'ActionLog' => luoyangpeng\ActionLog\Facades\ActionLogFacade::class,
]
To use your own settings, publish config.
$ php artisan vendor:publish
config/actionlog.php
//填写要记录的日志的模型名称
return [
'\App\Models\Users',
];
run:
$ php artisan migrate
自动记录操作日志,数据库操作需按如下:
update
$users = Users::find(1);
$users->name = "myname";
$users->save();
add
$users = new Users();
$users->name = "myname";
$users->save()
delete
Users:destroy(1);
主动记录操作日志
use ActionLog
ActionLog::createActionLog($type,$content);