Skip to content

Latest commit

 

History

History
20 lines (18 loc) · 390 Bytes

TraceIdBehavior.md

File metadata and controls

20 lines (18 loc) · 390 Bytes

属性行为封装:模型中客户端日志ID自动填充行为

  • 封装属性:trace_id
  • 封装事件:ActiveRecord::EVENT_BEFORE_INSERT
  • 返回值:客户端请求的链路ID

coding 示例

    /**
     * 绑定 behavior
     *
     * @return array
     */
    public function behaviors()
    {
        return [
            TraceIdBehavior::class
        ];
    }