承接 masterbroki/hookable 相关项目开发

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

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

masterbroki/hookable

最新稳定版本:v10.0.4

Composer 安装命令:

composer require masterbroki/hookable

包简介

Laravel Eloquent hooks system.

README 文档

README

GitHub Tests Action Status stable Downloads

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::getAttribute
  • Model::setAttribute
  • Model::save
  • Model::toArray
  • Model::replicate
  • Model::isDirty
  • Model::__isset
  • Model::__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
  • 点击次数: 2
  • 依赖项目数: 1
  • 推荐数: 0

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2023-05-21

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固