承接 zaengle/audits 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

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

zaengle/audits

最新稳定版本:v5.0.0

Composer 安装命令:

composer require zaengle/audits

包简介

A package to manage model audits

README 文档

README

Tests Latest Version on Packagist Total Downloads MIT Licensed

audit header

Audits

This packages records changes to a Laravel model and stores them in a json column on the model.

Usage

Use the MakesAudits trait on your model.

Next add a nullable json column to your model. By default the package will look for a column called audits. To override the auditable column, change the $auditableColumn property on your model.

protected $auditableColumn = 'audits';

Finally add a json cast for the auditable column.

protected $casts = [
    'audits' => 'json',
];

This is all you need to get started. The package will automatically record changes to the model and store them in the audits column.

If you ever need to save arbitrary data to the audit log you may do so by calling the manualAudit method.

$model = Model::find(1);

$model->manualAudit([
    'field' => 'value',
]);

Occasionally you may want to bypass writing to the audit log. In those cases you can override the shouldTriggerAudit function on your model like so:

// MyModel.php

public function shouldTriggerAudit(): bool
{
    return $someCondition ? true : false;
}

Attributions

If you are looking for a more robust solution, this package is worth checking out: Laravel Auditor

统计信息

  • 总下载量: 7.6k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 2
  • 点击次数: 1
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2020-12-03

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固