1, 'name' => '绿豆模板', 'value' => 'key' ], [ 'id' => 2, 'name' => '玉米模板', 'value' => 'yumi' ], [ 'id' => 3, 'name' => '经销商模板', 'value' => 'jingxiaoshang' ] ]; public function getTraceAttribute() { return Trace::where('gid', $this->attributes['id'])->count(); } }