PHP code example of brachiosx / laravel-audit-logger

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

    

brachiosx / laravel-audit-logger example snippets


return [
    'database' => [
        'connection' => '',             // table connection    
        'table_name' => 'laravel_audit_logger_table'       // table name for audit-log
    ],
    'ignore_fields' => ['updated_at'],                  // default ignore fields to skip log
];



namespace App\Models;

use BrachiosX\AuditLogger\Traits\HasAuditLog;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Foundation\Auth\User as Authenticatable;
use Illuminate\Notifications\Notifiable;
use Laravel\Sanctum\HasApiTokens;

class User extends Authenticatable
{
    use HasAuditLog, HasApiTokens, HasFactory, Notifiable;

    /**
     * @var string[]
     * field to ignore logging in this model
     */
    public array $ignore_auditing = ['created_by'];

    /**
     * action to disable for audit logging
     * values: ['created', 'updated', 'deleted'
     */
    public array $ignore_audit_actions = [];
}

bash
php artisan vendor:publish --tag="laravel-audit-logger-migrations"
php artisan migrate
bash
php artisan vendor:publish --tag="laravel-audit-logger-config"