jalallinux/laravel-postgres-audit

记录在Postgres上执行的查询,即使直接执行也行!!!

1.0.0 2022-11-24 19:53 UTC

README

Latest Version on Packagist Tests Total Downloads

记录在Postgres上执行的查询,即使直接执行也行!!!

安装

您可以通过composer安装此包

composer require jalallinux/laravel-postgres-audit

您可以使用以下命令发布配置文件

php artisan vendor:publish --provider="JalalLinuX\PostgreAudit\PGAuditServiceProviders"

这是已发布配置文件的内容

return [
/**
     * Target database connection
     */
    'connection' => 'pgsql',


    /**
     * Audit log table name
     */
    'table_name' => 'audit_logs',


    /**
     * Target tables for log
     * Set ['*'] to log for all tables
     * Split tables with comma
     */
    'target_tables' => '*',


    /**
     * Except tables for log
     * Except tables has more priority than target tables
     * Split tables with comma
     */
    'except_tables' => 'migrations, password_resets, personal_access_tokens, jobs, failed_jobs, notifications',


    /**
     * Ignore database user activity
     * Example: postgres, forge
     * NULL for logging all users
     * Split tables with comma
     */
    'except_users' => null,


    /**
     * Primary columns
     * Example: id, uuid, slug
     */
    'primary_columns' => 'uuid',


    /**
     * Primary columns type
     * Example: bigint, uuid, varchar
     */
    'primary_columns_type' => 'uuid',


    /**
     * Operations to log
     * Only support INSERT, DELETE, UPDATE
     */
    'operations' => 'INSERT, DELETE, UPDATE'
];

使用方法

设置

php artisan pg-audit:setup

模型

使用PGAudit模型进行操作。

\JalalLinuX\PostgreAudit\PGAudit::where('table_name', 'users')->get()

测试

composer test

变更日志

请参阅变更日志,了解最近的变化。

安全漏洞

请参阅我们的安全策略,了解如何报告安全漏洞。

致谢

许可

MIT许可(MIT)。请参阅许可文件以获取更多信息。