查询事件(V5.0.4+)

5.0.4+版本开始 增加了数据库的CURD操作事件支持 包括:

事件描述
before_selectselect查询前回调
before_findfind查询前回调
after_insertinsert操作成功后回调
after_updateupdate操作成功后回调
after_deletedelete操作成功后回调

查询事件仅支持findselectinsertupdatedelete方法。

注册事件

使用下面的方法注册数据库查询事件

Query::event('after_insert','callback');
Query::event('before_select',function($options,$query){
// 事件处理
    return $result;
});