PHP code example of aurorawebsoftware / logiaudit

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

    

aurorawebsoftware / logiaudit example snippets


addLog('info', 'User logged in', [
    'model_id' => $user->id,
    'model_type' => get_class($user),
    'trace_id' => Str::uuid(),
    'context' => ['role' => 'admin'],
    'ip_address' => request()->ip(),
    'deletable' => true,
    'delete_after_days' => 30,
]);

use Illuminate\Support\Facades\Log;

Log::channel('logiaudit')->info('Custom log message', [
    'model_id' => 1,
    'model_type' => 'User',
    'trace_id' => Str::uuid(),
    'context' => ['key' => 'value'],
    'ip_address' => request()->ip(),
]);

'channels' => [
    'logiaudit' => [
        'driver' => 'custom',
        'via' => AuroraWebSoftware\LogiAudit\Logging\LogiAuditHandler::class,
    ],
],

protected function schedule(Schedule $schedule)
{
    $schedule->command('logs:prune')->daily();
}

use HistoryableTrait;

protected $excludedColumns = ['deleted_at', 'id'];

protected $excludedEvents = ['delete', 'create'];
bash
php artisan migrate
bash
php artisan logs:prune
bash
php artisan history:prune {days}
bash
php artisan history:prune 30
bash
php artisan queue:work --queue=logiaudit