定制 nawasara/audit 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

nawasara/audit

最新稳定版本:v0.1.0

Composer 安装命令:

composer require nawasara/audit

包简介

Audit trail, activity logging, and login attempt tracking for the Nawasara superapp framework.

README 文档

README

Audit trail, activity logging, and login attempt tracking for the Nawasara superapp framework.

Features

  • Activity log — every significant write action (model create/update/delete) is recorded with the user, timestamp, and field-level diff using spatie/laravel-activitylog.
  • Login history — successful and failed authentication attempts are persisted, including IP address, user agent, and outcome.
  • Admin viewer — Livewire pages to browse, filter, and inspect activity log entries and login attempts without leaving Nawasara.
  • Permission-gated — viewing the audit pages requires Spatie permissions seeded by the package.

Installation

This package ships as part of the Nawasara monorepo and is auto-discovered by Laravel.

composer require nawasara/audit
php artisan migrate
php artisan db:seed --class="Nawasara\Audit\Database\Seeders\PermissionSeeder" --force

Usage

Enable activity logging on any Eloquent model:

use Spatie\Activitylog\Traits\LogsActivity;
use Spatie\Activitylog\LogOptions;

class Post extends Model
{
    use LogsActivity;

    public function getActivitylogOptions(): LogOptions
    {
        return LogOptions::defaults()
            ->logOnly(['title', 'body'])
            ->logOnlyDirty();
    }
}

Login attempts are recorded automatically by the bundled listeners; no caller code is required.

Pages

Route Permission Purpose
/admin/audit/activity audit.activity.view Filterable activity log viewer
/admin/audit/login-history audit.login.view Login attempt history

Author

Pringgo J. Saputro <odyinggo@gmail.com>

License

MIT

统计信息

  • 总下载量: 8
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 27
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 0
  • Forks: 0
  • 开发语言: Blade

其他信息

  • 授权协议: MIT
  • 更新时间: 2026-05-09