masterbroki/hookable
最新稳定版本:v10.0.4
Composer 安装命令:
composer require masterbroki/hookable
包简介
Laravel Eloquent hooks system.
关键字:
README 文档
README
This is a overhaul of the Hookable system from jarektkaczyk/hookable to support laravel 10 and make the system leaner.
Hooks system for the Eloquent ORM (Laravel 10.0).
Hooks are available for the following methods:
Model::getAttributeModel::setAttributeModel::saveModel::toArrayModel::replicateModel::isDirtyModel::__issetModel::__unset
and all methods available on the Illuminate\Database\Eloquent\Builder class.
Installation
Clone the repo or pull as composer dependency:
composer require masterbroki/hookable:~10.0
Usage
Use the hookable trait on the model:
class MyModel extends \Illuminate\Database\Eloquent\Model{ use Sofa\Hookable\Hookable; }
In order to register a hook, use the static method hook on the model:
MyModel::hook('myMethod', function($myParams){ return "I want to select: " . implode(', ', $myParams); });
And when the attribute is called:
$result = MyModel::select(["first", "second"]); // $result will equal "I want to select: first, second"
Contribution
All contributions are welcome, PRs must be tested.
统计信息
- 总下载量: 31
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 1
- 依赖项目数: 1
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2023-05-21