Skip to content

A laravel package of ActionLog,记录用户操作和api请求

License

Notifications You must be signed in to change notification settings

majikang/action-log

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

action-log

Laravel 5 操作日志记录

Installation

{
    "require": {
       
        "majikang/action-log": "~1.0"
    },
   
}

or

Require this package with composer:

composer require majikang/action-log 

Update your packages with composer update or install with composer install.

Usage

Find the providers key in config/app.php and register the ActionLog Service Provider.

for Laravel 5.1+

    'providers' => [
        majikang\ActionLog\ActionLogServiceProvider::class,
    ]

Find the aliases key in config/app.php.

for Laravel 5.1+

    'aliases' => [
        'ActionLog' => luoyangpeng\ActionLog\Facades\ActionLogFacade::class,
    ]

Configuration

To use your own settings, publish config.

$ php artisan vendor:publish

config/actionlog.php

//填写要记录的日志的模型名称
	return [
		'\App\Models\User',
	];

Last Step

$ php artisan migrate

Demo

自动记录操作日志,数据库操作需按如下:

update

$users = Users::find(1);
$users->name = "admin";
$users->save();

add

$users = new Users();
$users->name = "admin";
$users->save()

delete

Users:destroy(1);

主动记录操作日志

use ActionLog;

ActionLog::createActionLog($type,$content);
ActionLog::ApiLog($type,$content,$result);

About

A laravel package of ActionLog,记录用户操作和api请求

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages