2017 © Pedro Peláez
 

library actionlog

A laravel package of ActionLog

image

gaocheng/actionlog

A laravel package of ActionLog

  • Tuesday, June 12, 2018
  • by Gaocheng
  • Repository
  • 1 Watchers
  • 0 Stars
  • 1 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 1 Versions
  • 0 % Grown

The README.md

action log

Laravel 5 操作日志自动记录, (*1)

Installation

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

{
    "require": {

        "gaocheng/actionlog": "~1.0"
    },

}

or, (*3)

Require this package with composer:, (*4)

composer require gaocheng/actionlog 

Update your packages with composer update or install with composer install., (*5)

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., (*6)

Find the providers key in config/app.php and register the ActionLog Service Provider., (*7)

    'providers' => [
        // ...
        'gaocheng\ActionLog\ActionLogServiceProvider',
    ]

for Laravel 5.1+, (*8)

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

Find the aliases key in config/app.php., (*9)

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

for Laravel 5.1+, (*10)

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

Configuration

To use your own settings, publish config., (*11)

$ php artisan vendor:publish, (*12)

config/actionlog.php, (*13)

    /*
    |--------------------------------------------------------------------------
    | Package Connection
    |--------------------------------------------------------------------------
    |
    | You can set a different database connection for this package. It will set
    | new connection for models ActionLog. When this option is null,
    | it will connect to the main database, which is set up in database.php
    |
    */

    'connection' => null,

    /*
    |--------------------------------------------------------------------------
    | Package Models
    |--------------------------------------------------------------------------
    |
    | You can set up same models that requires logging. When this option is null,
    | no logging will be done.
    |
    */

    'models' => [
        '\App\User',
    ],

Last Step

run: $ php artisan migrate, (*14)

Demo

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


update $users = Users::find(1); $users->name = "myname"; $users->save(); add $users = new Users(); $users->name = "myname"; $users->save() delete Users:destroy(1);

主动记录操作日志, (*16)


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

感谢 https://github.com/luoyangpeng/action-log/, (*17)

The Versions

12/06 2018

dev-master

9999999-dev

A laravel package of ActionLog

  Sources   Download

MIT

The Requires

  • php >=5.4.0

 

by Avatar Gaocheng

laravel actionlog