phplaravellaravel-auditing

Laravel auditing: change the default table name "audits"


Since we are using the audits table already in our project, is there any way to change the table name from "audits" to like "audit_trail_histories"?


Solution

  • Update the up() and down() methods in the migration file, so that audit_trail_histories is set as the table name.

    // ...
    
    Schema::create('audit_trail_histories', function (Blueprint $table) {
        // ...
    });
    
    // ...
    
    Schema::drop('audit_trail_histories');
    
    // ...
    

    Execute php artisan migrate to create the table.

    Update the configuration like so:

    return [
        // ...
    
        'drivers' => [
            'database' => [
                'table' => 'audit_trail_histories',
                // ...
            ],
        ],
    
        // ...
    ];
    

    That's it!