dfox288/culpa
最新稳定版本:10.0.1
Composer 安装命令:
composer require dfox288/culpa
包简介
Adds Blameable support to Eloquent models in Laravel 7+
README 文档
README
Use BlueprintBigInt as Blueprint class
Culpa for Laravel 5 & 6

Blameable extension for Laravel 5 & 6 Eloquent ORM models. This extension automatically adds references to the authenticated user when creating, updating or soft-deleting a model.
Disclaimer: I've created this repository because I didn't want to include a dev-master version of the original fork in my composer.json. Once the original pull request gets merged, this package will probably become deprecated and you'll be best of switching back within a year. Due to changes in the namespace and directory structure this package is not backwards compatible with the original Culpa for laravel < 4.
Installation
To install the package in your project:
- Run
composer require nstapelbroek/culpa, - Add to the
providerslist in config/app.php:"Culpa\CulpaServiceProvider", - Publish the configuration to your application:
php artisan vendor:publish
Usage
You can add auditable fields on a per-model basis by adding a protected property
and a model observer. The property $blameable contains events you wish to
record - at present this is restricted to created, updated and deleted - which
function the same as Laravel's timestamps.
use Culpa\Traits\Blameable; use Culpa\Traits\CreatedBy; use Culpa\Traits\DeletedBy; use Culpa\Traits\UpdatedBy; use Illuminate\Database\Eloquent\Model; class Comment extends Model { use Blameable, CreatedBy, UpdatedBy, DeletedBy; protected $blameable = array('created', 'updated', 'deleted'); // Other model logic here }
- On create, the authenticated user will be set in
created_by, - On create and update, the authenticated user will be set in
updated_by, - If the model was soft-deletable, the authenticated user will be
set in
deleted_byon deletion.
To activate the automatic updating of these fields, you need to add the blamable trait to the model. That's it! Need more tweak options for Culpa? take a look at the [Tweaks and Configuration docs](docs/1. Tweaks and Configuration.md).
License
Culpa is released under the MIT License.
dfox288/culpa 适用场景与选型建议
dfox288/culpa 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 4.32k 次下载、GitHub Stars 达 0, 最近一次更新时间为 2020 年 07 月 01 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「Blameable」 「laravel」 「created-by」 「Blamable」 「updated-by」 「deleted-by」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 dfox288/culpa 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 dfox288/culpa 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 dfox288/culpa 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
Doctrine2 behavior traits - slowhop fork
Doctrine Behavior Traits for symfony 7+ and Doctrine DBAL 4+ and Doctrine ORM 3+
Doctrine2 behavior traits
Doctrine Behavior Traits
Adds Blameable support to Eloquent models in Laravel
Behavior for automate the update of username or user reference fields on your Entities.
统计信息
- 总下载量: 4.32k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 21
- 依赖项目数: 1
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2020-07-01