amol/reactiveci4

Codeigniter 4 的活动日志记录器

v1.0.2 2022-12-17 19:36 UTC

This package is auto-updated.

Last update: 2024-09-17 23:52:49 UTC


README

Latest Version on Packagist

amol/reactiveci4 帮助您轻松记录网站用户的活动。它将所有活动存储在数据库表 activity 中。它有助于提高工作效率。

功能

  1. 易于设置。
  2. 使用 Codeigniter 模型。
  3. 易于使用。

基本示例

helper('reactive');
reactive($user, "You updated the profile");

使用类的高级示例

use Amol\ReactiveCi4\Reactive;

$userModel = model('App\Models\UserModel');
$user = $userModel->find(1);
$properties = [
    "ip" => "127.0.0.1"
];
$label = "profile review"

$record = new Reactive();
$record->log($user, "admin changed user's profile photo", $admin, $properties, $label);

安装

您可以通过 composer 安装此软件包。

composer require amol/reactiveci4

安装后,运行 spark 命令

php spark reactive:setup

它将创建 Reactive 配置和 Activity 模型文件。它还会迁移 activity 表。

文档和示例

Reactive 类

具有 log 函数

public function log(object $subject, string $text, object $causer=null,array $properties=[], string $label=null ): id|false

助手

它还提供助手

function reactive(object $subject, string $text, object $causer=null,array $properties=[], string $label=null )

返回活动实例的 ID 或在失败时返回 false。

Activity 模型

您可以使用模型从活动表中检索数据,并对其进行 CRUD 操作。您还可以自定义模型。

标签

标签用于将记录分类到不同的组中。您可以使用配置文件更改其默认值。

完整文档和示例

即将推出

错误和问题

如果您发现任何错误,请毫不犹豫地创建一个 问题

贡献

有关详细信息,请参阅 CONTRIBUTING