定制 qylinfly/action-log 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

qylinfly/action-log

Composer 安装命令:

composer require qylinfly/action-log

包简介

A laravel package of ActionLog

README 文档

README

Laravel 5 The operation log is automatically recorded

Installation

The ActionLog Service Provider can be installed via Composer by requiring the qylinfly/action-log package and setting the minimum-stability to dev (required for Laravel 5) in your project's composer.json.

{
    "require": {
       
        "qylinfly/action-log": "2.0.*"
    },
    ...
}

or

Require this package with composer:

composer require qylinfly/action-log 

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

Usage

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' => [
        // ...
        'Qylinfly\ActionLog\ActionLogServiceProvider',
    ]

for Laravel 5.1+

    'providers' => [
        // ...
        Qylinfly\ActionLog\ActionLogServiceProvider::class,
    ]

Find the aliases key in config/app.php.

    'aliases' => [
        // ...
        'ActionLog' => 'Qylinfly\ActionLog\Facades\ActionLogFacade',
    ]

for Laravel 5.1+

    'aliases' => [
        // ...
        'ActionLog' => Qylinfly\ActionLog\Facades\ActionLogFacade::class,
    ]

Configuration

You can publish the migration with:

php artisan vendor:publish --provider="Qylinfly\ActionLog\ActionLogServiceProvider" --tag="migrations"

The package assumes that your users table name is called "users". If this is not the case you should manually edit the published migration to use your custom table name.

After the migration has been published you can create the role- and permission-tables by running the migrations:

php artisan migrate

You can publish the config-file with:

php artisan vendor:publish --provider="Qylinfly\ActionLog\ActionLogServiceProvider" --tag="config"

To use your own settings, publish config. config/actionlog.php

return [
    //Middleware which records the request method
    'request_methods'=>['POST','GET'],
    //Fill in the name of the model to be logged, which can be multiple
    'models'=>['\App\User'],
    //Whether it is open
    'enable'=>true
];

Demo

Automatically record the operation log, the database operation should be as follows:

update

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

add

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

delete

Users:destroy(1);

Active log operation log

  • Custom record user access
use ActionLog

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

Middleware

  • The middleware automatically records user access
class Kernel extends HttpKernel
{
    protected $middleware = [
       \Qylinfly\ActionLog\Middleware\UserActionLog::class
    ];
     ...
}

统计信息

  • 总下载量: 285
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 1
  • 点击次数: 2
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 1
  • Watchers: 1
  • Forks: 2
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2017-03-15

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固