PHP code example of qylinfly / action-log

1. Go to this page and download the library: Download qylinfly/action-log library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

qylinfly / action-log example snippets


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

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

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

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

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


update

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

add

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

delete

Users:destroy(1);



use ActionLog

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


class Kernel extends HttpKernel
{
    protected $middleware = [
       \Qylinfly\ActionLog\Middleware\UserActionLog::class
    ];
     ...
}
bash
php artisan vendor:publish --provider="Qylinfly\ActionLog\ActionLogServiceProvider" --tag="migrations"
bash
php artisan migrate
bash
php artisan vendor:publish --provider="Qylinfly\ActionLog\ActionLogServiceProvider" --tag="config"