A laravel package of ActionLog
Laravel 5 The operation log is automatically recorded, (*1)
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
., (*2)
{ "require": { "qylinfly/action-log": "2.0.*" }, ... }
or, (*3)
Require this package with composer:, (*4)
composer require qylinfly/action-log
Update your packages with composer update
or install with composer install
., (*5)
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' => [ // ... 'Qylinfly\ActionLog\ActionLogServiceProvider', ]
for Laravel 5.1+, (*8)
'providers' => [ // ... Qylinfly\ActionLog\ActionLogServiceProvider::class, ]
Find the aliases
key in config/app.php
., (*9)
'aliases' => [ // ... 'ActionLog' => 'Qylinfly\ActionLog\Facades\ActionLogFacade', ]
for Laravel 5.1+, (*10)
'aliases' => [ // ... 'ActionLog' => Qylinfly\ActionLog\Facades\ActionLogFacade::class, ]
You can publish the migration with:, (*11)
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., (*12)
After the migration has been published you can create the role- and permission-tables by running the migrations:, (*13)
php artisan migrate
You can publish the config-file with:, (*14)
php artisan vendor:publish --provider="Qylinfly\ActionLog\ActionLogServiceProvider" --tag="config"
To use your own settings, publish config.
config/actionlog.php
, (*15)
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 ];
Automatically record the operation log, the database operation should be as follows:, (*16)
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, (*17)
use ActionLog ActionLog::createActionLog($type,$content);
Middleware - The middleware automatically records user access, (*18)
class Kernel extends HttpKernel { protected $middleware = [ \Qylinfly\ActionLog\Middleware\UserActionLog::class ]; ... }