mjk0621 / action-log by mjk

A laravel package of ActionLog,记录用户操作和api请求
72
6
3
Package Data
Maintainer Username: mjk
Maintainer Contact: 10307440@qq.com (majikang)
Package Create Date: 2016-09-30
Package Last Update: 2017-04-11
Language: PHP
License: MIT
Last Refreshed: 2024-12-19 03:15:14
Package Statistics
Total Downloads: 72
Monthly Downloads: 0
Daily Downloads: 0
Total Stars: 6
Total Watchers: 3
Total Forks: 2
Total Open Issues: 0

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);