PHP code example of mblsolutions / audit-logging

1. Go to this page and download the library: Download mblsolutions/audit-logging 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/ */

    

mblsolutions / audit-logging example snippets


\MBLSolutions\AuditLogging\AuditLoggingServiceProvider::class,

Copy the package configuration to your local config directory.

// Request Audit Logging
'enabled' => env('AUDIT_LOGGING_ENABLED', false),

// Event Audit Logging
'event_enabled' => env('EVENT_AUDIT_LOGGING_ENABLED', true)

use Illuminate\Routing\Route;

Route::get('/user', function () {
    //
})->middleware('web-audit-logging');

use Illuminate\Routing\Route;
use MBLSolutions\AuditLogging\Http\Middleware\AuditLogging;

Route::get('/user', function () {
    //
})->middleware(AuditLogging::class);

use Illuminate\Routing\Route;

Route::middleware(['web-audit-logging'])->group(function () {

    Route::get('/', function () {
        //
    });

    Route::get('/user', function () {
        //
    });

});

use Illuminate\Routing\Route;

Route::middleware(['api-audit-logging'])->group(function () {

    Route::get('/', function () {
        //
    })->withoutMiddleware(['api-audit-logging']);

    Route::get('/user', function () {
        //
    });

});


$config = config('audit-logging.drivers.database');

$auditLog = new MBLSolutions\AuditLogging\Models\AuditLog;
$auditLog->setConnection($config['connection']);
$auditLog->setTable($config['table']);
bash
php composer 
bash
php artisan vendor:publish --tag=audit-logging-config
bash
php artisan audit:database:table
`bash
php artisan migrate
`bash
php artisan audit:database:archive
`bash
php artisan audit:update:addindex
`bash
php artisan migrate