定制 zairakai/laravel-activity 二次开发

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

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

zairakai/laravel-activity

最新稳定版本:v2.0.9

Composer 安装命令:

composer require zairakai/laravel-activity

包简介

Enhanced activity logging helpers for Spatie Laravel Activity Log with pivot table support

README 文档

README

Main Develop Coverage

GitLab Release Packagist Downloads License

PHP Laravel Static Analysis Code Style

Pivot activity logging for Eloquent many-to-many relationships, built on top of Spatie Laravel Activity Log.

Features

  • Fluent API — chainable ->activity()->by()->withMessage()->sync() on any BelongsToMany relation
  • Automatic diffing — logs attached, detached, and unchanged IDs on every sync operation
  • Actor tracking->by($user) records who performed the action
  • Custom messages->withMessage('Assigned roles') for human-readable log entries
  • Zero configuration — no config file needed, just composer require

Requirements

  • spatie/laravel-activitylog must be installed and configured

Install

composer require zairakai/laravel-activity

Usage

use App\Models\User;

$user = User::find(1);

// Log a sync operation on a BelongsToMany relationship
$user->roles()
    ->activity()
    ->by(auth()->user())
    ->withMessage('Assigned roles')
    ->sync([1, 2, 3]);

// Without an actor
$user->permissions()
    ->activity()
    ->withMessage('Permissions updated')
    ->sync([10, 20]);

// Attach and detach also fire activity
$user->tags()->activity()->attach(5);
$user->tags()->activity()->detach(5);

The activity log will record:

  • attached: IDs that were added
  • detached: IDs that were removed
  • unchanged: IDs that were already present

Development

make quality        # pint + phpstan + rector + insights + markdownlint + shellcheck
make quality-fast   # pint + phpstan + markdownlint
make test           # phpunit / pest

Contributing

Contributions are welcome. Please read CONTRIBUTING.md for the project-specific workflow and quality standards.

Getting Help

License Security Policy Issues

Made with ❤️ by Zairakai

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2026-03-11

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固